mirror of
https://github.com/github/codeql-action.git
synced 2025-12-23 15:50:11 +08:00
tests: instead of false, use old feature flag with default value of false
This commit is contained in:
4
lib/codeql.js
generated
4
lib/codeql.js
generated
@@ -115,9 +115,9 @@ const CODEQL_VERSION_CACHE_CLEANUP = "2.17.1";
|
|||||||
* version requirement. Must be set to true outside tests.
|
* version requirement. Must be set to true outside tests.
|
||||||
* @returns a { CodeQL, toolsVersion } object.
|
* @returns a { CodeQL, toolsVersion } object.
|
||||||
*/
|
*/
|
||||||
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, features, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger);
|
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, features, defaultCliVersion, logger);
|
||||||
logger.debug(`Bundle download status report: ${JSON.stringify(toolsDownloadStatusReport)}`);
|
logger.debug(`Bundle download status report: ${JSON.stringify(toolsDownloadStatusReport)}`);
|
||||||
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
|
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
27
lib/codeql.test.js
generated
27
lib/codeql.test.js
generated
@@ -41,6 +41,7 @@ const cli_errors_1 = require("./cli-errors");
|
|||||||
const codeql = __importStar(require("./codeql"));
|
const codeql = __importStar(require("./codeql"));
|
||||||
const defaults = __importStar(require("./defaults.json"));
|
const defaults = __importStar(require("./defaults.json"));
|
||||||
const doc_url_1 = require("./doc-url");
|
const doc_url_1 = require("./doc-url");
|
||||||
|
const feature_flags_test_1 = require("./feature-flags.test");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const setup_codeql_1 = require("./setup-codeql");
|
const setup_codeql_1 = require("./setup-codeql");
|
||||||
@@ -50,6 +51,12 @@ const util = __importStar(require("./util"));
|
|||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
let stubConfig;
|
let stubConfig;
|
||||||
|
// TODO: Remove when when we no longer need to pass in features
|
||||||
|
const expectedFeatureEnablement = (0, feature_flags_test_1.initializeFeatures)(true);
|
||||||
|
expectedFeatureEnablement.getValue = function (feature) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return expectedFeatureEnablement[feature];
|
||||||
|
};
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)("1.2.3");
|
||||||
stubConfig = (0, testing_utils_1.createTestConfig)({
|
stubConfig = (0, testing_utils_1.createTestConfig)({
|
||||||
@@ -60,7 +67,7 @@ async function installIntoToolcache({ apiDetails = testing_utils_1.SAMPLE_DOTCOM
|
|||||||
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
|
||||||
await codeql.setupCodeQL(cliVersion !== undefined ? undefined : url, apiDetails, tmpDir, util.GitHubVariant.GHES, cliVersion !== undefined
|
await codeql.setupCodeQL(cliVersion !== undefined ? undefined : url, apiDetails, tmpDir, util.GitHubVariant.GHES, cliVersion !== undefined
|
||||||
? { cliVersion, tagName }
|
? { cliVersion, tagName }
|
||||||
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
}
|
}
|
||||||
function mockReleaseApi({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, assetNames, tagName, }) {
|
function mockReleaseApi({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, assetNames, tagName, }) {
|
||||||
return (0, nock_1.default)(apiDetails.apiURL)
|
return (0, nock_1.default)(apiDetails.apiURL)
|
||||||
@@ -97,7 +104,7 @@ function mockApiDetails(apiDetails) {
|
|||||||
tagName: `codeql-bundle-${version}`,
|
tagName: `codeql-bundle-${version}`,
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||||
t.is(result.toolsVersion, `0.0.0-${version}`);
|
t.is(result.toolsVersion, `0.0.0-${version}`);
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
@@ -112,7 +119,7 @@ function mockApiDetails(apiDetails) {
|
|||||||
tagName: `codeql-bundle-v2.15.0`,
|
tagName: `codeql-bundle-v2.15.0`,
|
||||||
isPinned: false,
|
isPinned: false,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.is(toolcache.findAllVersions("CodeQL").length, 1);
|
t.is(toolcache.findAllVersions("CodeQL").length, 1);
|
||||||
t.assert(toolcache.find("CodeQL", `2.15.0`));
|
t.assert(toolcache.find("CodeQL", `2.15.0`));
|
||||||
t.is(result.toolsVersion, `2.15.0`);
|
t.is(result.toolsVersion, `2.15.0`);
|
||||||
@@ -133,7 +140,7 @@ function mockApiDetails(apiDetails) {
|
|||||||
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: "codeql-bundle-20200610",
|
tagName: "codeql-bundle-20200610",
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||||
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
t.deepEqual(result.toolsVersion, "0.0.0-20200610");
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
@@ -161,7 +168,7 @@ for (const { tagName, expectedToolcacheVersion, } of EXPLICITLY_REQUESTED_BUNDLE
|
|||||||
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName,
|
tagName,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(url, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||||
t.deepEqual(result.toolsVersion, expectedToolcacheVersion);
|
t.deepEqual(result.toolsVersion, expectedToolcacheVersion);
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
@@ -184,7 +191,7 @@ for (const toolcacheVersion of [
|
|||||||
.withArgs("CodeQL", toolcacheVersion)
|
.withArgs("CodeQL", toolcacheVersion)
|
||||||
.returns("path/to/cached/codeql");
|
.returns("path/to/cached/codeql");
|
||||||
sinon.stub(toolcache, "findAllVersions").returns([toolcacheVersion]);
|
sinon.stub(toolcache, "findAllVersions").returns([toolcacheVersion]);
|
||||||
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.is(result.toolsVersion, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
t.is(result.toolsVersion, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
|
||||||
t.is(result.toolsDownloadStatusReport?.combinedDurationMs, undefined);
|
t.is(result.toolsDownloadStatusReport?.combinedDurationMs, undefined);
|
||||||
@@ -204,7 +211,7 @@ for (const toolcacheVersion of [
|
|||||||
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.GHES, {
|
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.GHES, {
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
}, (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
|
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Toolcache);
|
||||||
t.is(result.toolsDownloadStatusReport?.combinedDurationMs, undefined);
|
t.is(result.toolsDownloadStatusReport?.combinedDurationMs, undefined);
|
||||||
@@ -228,7 +235,7 @@ for (const toolcacheVersion of [
|
|||||||
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.GHES, {
|
const result = await codeql.setupCodeQL(undefined, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.GHES, {
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
}, (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
if (result.toolsDownloadStatusReport) {
|
if (result.toolsDownloadStatusReport) {
|
||||||
@@ -249,7 +256,7 @@ for (const toolcacheVersion of [
|
|||||||
(0, testing_utils_1.mockBundleDownloadApi)({
|
(0, testing_utils_1.mockBundleDownloadApi)({
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL("latest", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL("latest", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
if (result.toolsDownloadStatusReport) {
|
if (result.toolsDownloadStatusReport) {
|
||||||
@@ -273,7 +280,7 @@ for (const toolcacheVersion of [
|
|||||||
platformSpecific: false,
|
platformSpecific: false,
|
||||||
tagName: "codeql-bundle-20230203",
|
tagName: "codeql-bundle-20230203",
|
||||||
});
|
});
|
||||||
const result = await codeql.setupCodeQL("https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), false);
|
const result = await codeql.setupCodeQL("https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, tmpDir, util.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), expectedFeatureEnablement, false);
|
||||||
t.is(result.toolsVersion, "0.0.0-20230203");
|
t.is(result.toolsVersion, "0.0.0-20230203");
|
||||||
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
t.is(result.toolsSource, setup_codeql_1.ToolsSource.Download);
|
||||||
if (result.toolsDownloadStatusReport) {
|
if (result.toolsDownloadStatusReport) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
6
lib/feature-flags.js
generated
6
lib/feature-flags.js
generated
@@ -63,6 +63,7 @@ var Feature;
|
|||||||
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
Feature["ExportDiagnosticsEnabled"] = "export_diagnostics_enabled";
|
||||||
Feature["PythonDefaultIsToNotExtractStdlib"] = "python_default_is_to_not_extract_stdlib";
|
Feature["PythonDefaultIsToNotExtractStdlib"] = "python_default_is_to_not_extract_stdlib";
|
||||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||||
|
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
|
||||||
})(Feature || (exports.Feature = Feature = {}));
|
})(Feature || (exports.Feature = Feature = {}));
|
||||||
exports.featureConfig = {
|
exports.featureConfig = {
|
||||||
[Feature.ArtifactV4Upgrade]: {
|
[Feature.ArtifactV4Upgrade]: {
|
||||||
@@ -80,6 +81,11 @@ exports.featureConfig = {
|
|||||||
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
|
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
},
|
},
|
||||||
|
[Feature.ZstdBundleStreamingExtraction]: {
|
||||||
|
defaultValue: false,
|
||||||
|
envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION",
|
||||||
|
minimumVersion: undefined,
|
||||||
|
},
|
||||||
[Feature.CppDependencyInstallation]: {
|
[Feature.CppDependencyInstallation]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
1
lib/feature-flags.test.js
generated
1
lib/feature-flags.test.js
generated
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.initializeFeatures = initializeFeatures;
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
lib/init-action.js
generated
2
lib/init-action.js
generated
@@ -162,7 +162,7 @@ async function run() {
|
|||||||
}
|
}
|
||||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
||||||
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
|
toolsFeatureFlagsValid = codeQLDefaultVersionInfo.toolsFeatureFlagsValid;
|
||||||
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, logger);
|
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, features, logger);
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
toolsDownloadStatusReport = initCodeQLResult.toolsDownloadStatusReport;
|
toolsDownloadStatusReport = initCodeQLResult.toolsDownloadStatusReport;
|
||||||
toolsVersion = initCodeQLResult.toolsVersion;
|
toolsVersion = initCodeQLResult.toolsVersion;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
4
lib/init.js
generated
4
lib/init.js
generated
@@ -40,9 +40,9 @@ const languages_1 = require("./languages");
|
|||||||
const tools_features_1 = require("./tools-features");
|
const tools_features_1 = require("./tools-features");
|
||||||
const tracer_config_1 = require("./tracer-config");
|
const tracer_config_1 = require("./tracer-config");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||||
logger.startGroup("Setup CodeQL tools");
|
logger.startGroup("Setup CodeQL tools");
|
||||||
const { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, true);
|
const { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, features, true);
|
||||||
await codeql.printVersion();
|
await codeql.printVersion();
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,gCAuCC;AAED,gCAgBC;AAED,0BAkCC;AAED,0DAeC;AAMD,sDAkBC;AAED,0EAkDC;AA9MD,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,iDAAsE;AAEtE,qCAA+C;AAC/C,4DAA8C;AAE9C,2CAA0D;AAK1D,qDAAgD;AAChD,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,UAA8B,EAC9B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAA2C,EAC3C,MAAc;IAQd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EACJ,MAAM,EACN,yBAAyB,EACzB,WAAW,EACX,YAAY,EACZ,gBAAgB,GACjB,GAAG,MAAM,IAAA,oBAAW,EACnB,UAAU,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,IAAI,CACL,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO;QACL,MAAM;QACN,yBAAy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yC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
||||||
8
lib/setup-codeql.js
generated
8
lib/setup-codeql.js
generated
@@ -379,7 +379,7 @@ async function tryGetFallbackToolcacheVersion(cliVersion, tagName, logger) {
|
|||||||
}
|
}
|
||||||
// Exported using `export const` for testing purposes. Specifically, we want to
|
// Exported using `export const` for testing purposes. Specifically, we want to
|
||||||
// be able to stub this function and have other functions in this file use that stub.
|
// be able to stub this function and have other functions in this file use that stub.
|
||||||
const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVersion, apiDetails, tarVersion, tempDir, logger) {
|
const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVersion, apiDetails, tarVersion, tempDir, features, logger) {
|
||||||
const parsedCodeQLURL = new URL(codeqlURL);
|
const parsedCodeQLURL = new URL(codeqlURL);
|
||||||
const searchParams = new URLSearchParams(parsedCodeQLURL.search);
|
const searchParams = new URLSearchParams(parsedCodeQLURL.search);
|
||||||
const headers = {
|
const headers = {
|
||||||
@@ -401,7 +401,7 @@ const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVe
|
|||||||
else {
|
else {
|
||||||
logger.debug("Downloading CodeQL tools without an authorization token.");
|
logger.debug("Downloading CodeQL tools without an authorization token.");
|
||||||
}
|
}
|
||||||
const { extractedBundlePath, statusReport } = await (0, tools_download_1.downloadAndExtract)(codeqlURL, authorization, { "User-Agent": "CodeQL Action", ...headers }, tarVersion, tempDir, logger);
|
const { extractedBundlePath, statusReport } = await (0, tools_download_1.downloadAndExtract)(codeqlURL, authorization, { "User-Agent": "CodeQL Action", ...headers }, tarVersion, tempDir, features, logger);
|
||||||
const bundleVersion = maybeBundleVersion ?? tryGetBundleVersionFromUrl(codeqlURL, logger);
|
const bundleVersion = maybeBundleVersion ?? tryGetBundleVersionFromUrl(codeqlURL, logger);
|
||||||
if (bundleVersion === undefined) {
|
if (bundleVersion === undefined) {
|
||||||
logger.debug("Could not cache CodeQL tools because we could not determine the bundle version from the " +
|
logger.debug("Could not cache CodeQL tools because we could not determine the bundle version from the " +
|
||||||
@@ -462,7 +462,7 @@ function getCanonicalToolcacheVersion(cliVersion, bundleVersion, logger) {
|
|||||||
*
|
*
|
||||||
* @returns the path to the extracted bundle, and the version of the tools
|
* @returns the path to the extracted bundle, and the version of the tools
|
||||||
*/
|
*/
|
||||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, features, defaultCliVersion, logger) {
|
||||||
const zstdAvailability = await tar.isZstdAvailable(logger);
|
const zstdAvailability = await tar.isZstdAvailable(logger);
|
||||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, zstdAvailability.available, logger);
|
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, zstdAvailability.available, logger);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
@@ -482,7 +482,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||||||
toolsSource = ToolsSource.Toolcache;
|
toolsSource = ToolsSource.Toolcache;
|
||||||
break;
|
break;
|
||||||
case "download": {
|
case "download": {
|
||||||
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.bundleVersion, source.cliVersion, apiDetails, zstdAvailability.version, tempDir, logger);
|
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.bundleVersion, source.cliVersion, apiDetails, zstdAvailability.version, tempDir, features, logger);
|
||||||
toolsVersion = result.toolsVersion;
|
toolsVersion = result.toolsVersion;
|
||||||
codeqlFolder = result.codeqlFolder;
|
codeqlFolder = result.codeqlFolder;
|
||||||
toolsDownloadStatusReport = result.statusReport;
|
toolsDownloadStatusReport = result.statusReport;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
11
lib/setup-codeql.test.js
generated
11
lib/setup-codeql.test.js
generated
@@ -30,11 +30,18 @@ const path = __importStar(require("path"));
|
|||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const sinon = __importStar(require("sinon"));
|
const sinon = __importStar(require("sinon"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
|
const feature_flags_test_1 = require("./feature-flags.test");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const setupCodeql = __importStar(require("./setup-codeql"));
|
const setupCodeql = __importStar(require("./setup-codeql"));
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
|
// TODO: Remove when when we no longer need to pass in features
|
||||||
|
const expectedFeatureEnablement = (0, feature_flags_test_1.initializeFeatures)(true);
|
||||||
|
expectedFeatureEnablement.getValue = function (feature) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return expectedFeatureEnablement[feature];
|
||||||
|
};
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)("1.2.3");
|
||||||
});
|
});
|
||||||
@@ -127,7 +134,7 @@ ava_1.default.beforeEach(() => {
|
|||||||
});
|
});
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
const result = await setupCodeql.setupCodeQLBundle("linked", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
|
const result = await setupCodeql.setupCodeQLBundle("linked", testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, expectedFeatureEnablement, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
|
||||||
// Basic sanity check that the version we got back is indeed
|
// Basic sanity check that the version we got back is indeed
|
||||||
// the linked (default) CLI version.
|
// the linked (default) CLI version.
|
||||||
t.is(result.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
t.is(result.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
||||||
@@ -158,7 +165,7 @@ ava_1.default.beforeEach(() => {
|
|||||||
});
|
});
|
||||||
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
const result = await setupCodeql.setupCodeQLBundle(bundleUrl, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
|
const result = await setupCodeql.setupCodeQLBundle(bundleUrl, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, "tmp/codeql_action_test/", util_1.GitHubVariant.DOTCOM, expectedFeatureEnablement, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, logger);
|
||||||
// Basic sanity check that the version we got back is indeed the version that the
|
// Basic sanity check that the version we got back is indeed the version that the
|
||||||
// bundle contains..
|
// bundle contains..
|
||||||
t.is(result.toolsVersion, expectedVersion);
|
t.is(result.toolsVersion, expectedVersion);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
8
lib/tools-download.js
generated
8
lib/tools-download.js
generated
@@ -30,6 +30,7 @@ const perf_hooks_1 = require("perf_hooks");
|
|||||||
const toolcache = __importStar(require("@actions/tool-cache"));
|
const toolcache = __importStar(require("@actions/tool-cache"));
|
||||||
const follow_redirects_1 = require("follow-redirects");
|
const follow_redirects_1 = require("follow-redirects");
|
||||||
const uuid_1 = require("uuid");
|
const uuid_1 = require("uuid");
|
||||||
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const logging_1 = require("./logging");
|
const logging_1 = require("./logging");
|
||||||
const tar = __importStar(require("./tar"));
|
const tar = __importStar(require("./tar"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
@@ -53,12 +54,13 @@ function makeStreamedToolsDownloadDurations(combinedDurationMs) {
|
|||||||
streamExtraction: true,
|
streamExtraction: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function downloadAndExtract(codeqlURL, authorization, headers, tarVersion, tempDir, logger) {
|
async function downloadAndExtract(codeqlURL, authorization, headers, tarVersion, tempDir, features, logger) {
|
||||||
logger.info(`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`);
|
logger.info(`Downloading CodeQL tools from ${codeqlURL} . This may take a while.`);
|
||||||
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
|
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
|
||||||
// TODO: Re-enable streaming when we have a more reliable way to respect proxy settings.
|
// TODO: Re-enable streaming when we have a more reliable way to respect proxy settings.
|
||||||
// eslint-disable-next-line no-constant-condition, no-constant-binary-expression
|
if ((await features.getValue(feature_flags_1.Feature.ZstdBundleStreamingExtraction)) &&
|
||||||
if (false && compressionMethod === "zstd" && process.platform === "linux") {
|
compressionMethod === "zstd" &&
|
||||||
|
process.platform === "linux") {
|
||||||
logger.info(`Streaming the extraction of the CodeQL bundle.`);
|
logger.info(`Streaming the extraction of the CodeQL bundle.`);
|
||||||
const toolsInstallStart = perf_hooks_1.performance.now();
|
const toolsInstallStart = perf_hooks_1.performance.now();
|
||||||
const extractedBundlePath = await downloadAndExtractZstdWithStreaming(codeqlURL, authorization, headers, tarVersion, logger);
|
const extractedBundlePath = await downloadAndExtractZstdWithStreaming(codeqlURL, authorization, headers, tarVersion, logger);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tools-download.js","sourceRoot":"","sources":["../src/tools-download.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,gDAoGC;AA3KD,2CAA6B;AAC7B,2CAAyC;AAEzC,+DAAiD;AACjD,uDAAyC;AACzC,+BAAoC;AAEpC,uCAAmD;AACnD,2CAA6B;AAC7B,iCAAqC;AAErC;;GAEG;AACU,QAAA,8BAA8B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AAavE,SAAS,uCAAuC,CAC9C,kBAA0B,EAC1B,oBAA4B;IAE5B,OAAO;QACL,kBAAkB,EAAE,kBAAkB,GAAG,oBAAoB;QAC7D,kBAAkB;QAClB,oBAAoB;QACpB,gBAAgB,EAAE,KAAK;KACxB,CAAC;AACJ,CAAC;AAaD,SAAS,kCAAkC,CACzC,kBAA0B;IAE1B,OAAO;QACL,kBAAkB;QAClB,kBAAkB,EAAE,SAAS;QAC7B,oBAAoB,EAAE,SAAS;QAC/B,gBAAgB,EAAE,IAAI;KACvB,CAAC;AACJ,CAAC;AAYM,KAAK,UAAU,kBAAkB,CACtC,SAAiB,EACjB,aAAiC,EACjC,OAA4B,EAC5B,UAAsC,EACtC,OAAe,EACf,MAAc;IAKd,MAAM,CAAC,IAAI,CACT,iCAAiC,SAAS,2BAA2B,CACtE,CAAC;IAEF,MAAM,iBAAiB,GAAG,GAAG,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAEhE,wFAAwF;IACxF,gFAAgF;IAChF,IAAI,KAAK,IAAI,iBAAiB,KAAK,MAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC1E,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAE9D,MAAM,iBAAiB,GA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C9B,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAClB,CACF,CAAC;IAEF,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CACb,yCAAyC,SAAS,uBAAuB,QAAQ,CAAC,UAAU,GAAG,CAChG,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW;IAC7C,OAAO,CAAC,sBAAsB,EAAE,kCAAkC,CAAC,CAAC,IAAI,CACtE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,sBAAsB,IAAI,qBAAqB,CAAC,CAC1E;QACC,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,iBAAiB,CAAC;AACxB,CAAC"}
|
||||||
2
lib/upload-lib.js
generated
2
lib/upload-lib.js
generated
@@ -173,7 +173,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
|
|||||||
};
|
};
|
||||||
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
const codeQLDefaultVersionInfo = await features.getDefaultCliVersion(gitHubVersion.type);
|
||||||
const initCodeQLResult = await (0, init_1.initCodeQL)(undefined, // There is no tools input on the upload action
|
const initCodeQLResult = await (0, init_1.initCodeQL)(undefined, // There is no tools input on the upload action
|
||||||
apiDetails, tempDir, gitHubVersion.type, codeQLDefaultVersionInfo, logger);
|
apiDetails, tempDir, gitHubVersion.type, codeQLDefaultVersionInfo, features, logger);
|
||||||
codeQL = initCodeQLResult.codeql;
|
codeQL = initCodeQLResult.codeql;
|
||||||
}
|
}
|
||||||
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
|
if (!(await codeQL.supportsFeature(tools_features_1.ToolsFeature.SarifMergeRunsFromEqualCategory))) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -17,6 +17,8 @@ import * as codeql from "./codeql";
|
|||||||
import { AugmentationProperties, Config } from "./config-utils";
|
import { AugmentationProperties, Config } from "./config-utils";
|
||||||
import * as defaults from "./defaults.json";
|
import * as defaults from "./defaults.json";
|
||||||
import { DocUrl } from "./doc-url";
|
import { DocUrl } from "./doc-url";
|
||||||
|
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||||
|
import { initializeFeatures } from "./feature-flags.test";
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
@@ -39,6 +41,15 @@ setupTests(test);
|
|||||||
|
|
||||||
let stubConfig: Config;
|
let stubConfig: Config;
|
||||||
|
|
||||||
|
// TODO: Remove when when we no longer need to pass in features
|
||||||
|
const expectedFeatureEnablement: FeatureEnablement = initializeFeatures(
|
||||||
|
true,
|
||||||
|
) as FeatureEnablement;
|
||||||
|
expectedFeatureEnablement.getValue = function (feature: Feature) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return expectedFeatureEnablement[feature];
|
||||||
|
};
|
||||||
|
|
||||||
test.beforeEach(() => {
|
test.beforeEach(() => {
|
||||||
initializeEnvironment("1.2.3");
|
initializeEnvironment("1.2.3");
|
||||||
|
|
||||||
@@ -70,6 +81,7 @@ async function installIntoToolcache({
|
|||||||
? { cliVersion, tagName }
|
? { cliVersion, tagName }
|
||||||
: SAMPLE_DEFAULT_CLI_VERSION,
|
: SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -129,6 +141,7 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -155,6 +168,7 @@ test("caches semantically versioned bundles using their semantic version number"
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -188,6 +202,7 @@ test("downloads an explicitly requested bundle even if a different version is ca
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||||
@@ -232,6 +247,7 @@ for (const {
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
t.assert(toolcache.find("CodeQL", expectedToolcacheVersion));
|
||||||
@@ -270,6 +286,7 @@ for (const toolcacheVersion of [
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
t.is(result.toolsVersion, SAMPLE_DEFAULT_CLI_VERSION.cliVersion);
|
||||||
@@ -302,6 +319,7 @@ test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
|
|||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
},
|
},
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
|
t.deepEqual(result.toolsVersion, "0.0.0-20200601");
|
||||||
@@ -338,6 +356,7 @@ test(`downloads bundle if only an unpinned version is cached on GHES`, async (t)
|
|||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
},
|
},
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
@@ -371,6 +390,7 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
t.deepEqual(result.toolsVersion, defaults.cliVersion);
|
||||||
@@ -399,7 +419,6 @@ test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t)
|
|||||||
platformSpecific: false,
|
platformSpecific: false,
|
||||||
tagName: "codeql-bundle-20230203",
|
tagName: "codeql-bundle-20230203",
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await codeql.setupCodeQL(
|
const result = await codeql.setupCodeQL(
|
||||||
"https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz",
|
"https://github.com/codeql-testing/codeql-cli-nightlies/releases/download/codeql-bundle-20230203/codeql-bundle.tar.gz",
|
||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
@@ -407,6 +426,7 @@ test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t)
|
|||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
|
expectedFeatureEnablement,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ export async function setupCodeQL(
|
|||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
|
features: FeatureEnablement,
|
||||||
checkVersion: boolean,
|
checkVersion: boolean,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
codeql: CodeQL;
|
codeql: CodeQL;
|
||||||
@@ -364,6 +365,7 @@ export async function setupCodeQL(
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
|
features,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ function assertAllFeaturesUndefinedInApi(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeFeatures(initialValue: boolean) {
|
export function initializeFeatures(initialValue: boolean) {
|
||||||
return Object.keys(featureConfig).reduce((features, key) => {
|
return Object.keys(featureConfig).reduce((features, key) => {
|
||||||
features[key] = initialValue;
|
features[key] = initialValue;
|
||||||
return features;
|
return features;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ export enum Feature {
|
|||||||
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
ExportDiagnosticsEnabled = "export_diagnostics_enabled",
|
||||||
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
|
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
|
||||||
QaTelemetryEnabled = "qa_telemetry_enabled",
|
QaTelemetryEnabled = "qa_telemetry_enabled",
|
||||||
|
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const featureConfig: Record<
|
export const featureConfig: Record<
|
||||||
@@ -107,6 +108,11 @@ export const featureConfig: Record<
|
|||||||
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
|
envVar: "CODEQL_EXTRACTOR_CPP_BUILD_MODE_NONE",
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
},
|
},
|
||||||
|
[Feature.ZstdBundleStreamingExtraction]: {
|
||||||
|
defaultValue: false,
|
||||||
|
envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION",
|
||||||
|
minimumVersion: undefined,
|
||||||
|
},
|
||||||
[Feature.CppDependencyInstallation]: {
|
[Feature.CppDependencyInstallation]: {
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||||
|
|||||||
@@ -319,6 +319,7 @@ async function run() {
|
|||||||
getTemporaryDirectory(),
|
getTemporaryDirectory(),
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
codeql = initCodeQLResult.codeql;
|
codeql = initCodeQLResult.codeql;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { getOptionalInput, isSelfHostedRunner } from "./actions-util";
|
|||||||
import { GitHubApiCombinedDetails, GitHubApiDetails } from "./api-client";
|
import { GitHubApiCombinedDetails, GitHubApiDetails } from "./api-client";
|
||||||
import { CodeQL, setupCodeQL } from "./codeql";
|
import { CodeQL, setupCodeQL } from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { CodeQLDefaultVersionInfo } from "./feature-flags";
|
import { CodeQLDefaultVersionInfo, FeatureEnablement } from "./feature-flags";
|
||||||
import { Language, isScannedLanguage } from "./languages";
|
import { Language, isScannedLanguage } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
@@ -24,6 +24,7 @@ export async function initCodeQL(
|
|||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
codeql: CodeQL;
|
codeql: CodeQL;
|
||||||
@@ -46,6 +47,7 @@ export async function initCodeQL(
|
|||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
logger,
|
logger,
|
||||||
|
features,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
await codeql.printVersion();
|
await codeql.printVersion();
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import test from "ava";
|
|||||||
import * as sinon from "sinon";
|
import * as sinon from "sinon";
|
||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
|
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||||
|
import { initializeFeatures } from "./feature-flags.test";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import * as setupCodeql from "./setup-codeql";
|
import * as setupCodeql from "./setup-codeql";
|
||||||
import {
|
import {
|
||||||
@@ -25,6 +27,14 @@ import {
|
|||||||
|
|
||||||
setupTests(test);
|
setupTests(test);
|
||||||
|
|
||||||
|
// TODO: Remove when when we no longer need to pass in features
|
||||||
|
const expectedFeatureEnablement: FeatureEnablement = initializeFeatures(
|
||||||
|
true,
|
||||||
|
) as FeatureEnablement;
|
||||||
|
expectedFeatureEnablement.getValue = function (feature: Feature) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||||
|
return expectedFeatureEnablement[feature];
|
||||||
|
};
|
||||||
test.beforeEach(() => {
|
test.beforeEach(() => {
|
||||||
initializeEnvironment("1.2.3");
|
initializeEnvironment("1.2.3");
|
||||||
});
|
});
|
||||||
@@ -174,6 +184,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
"tmp/codeql_action_test/",
|
"tmp/codeql_action_test/",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
|
expectedFeatureEnablement,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
@@ -224,6 +235,7 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
|
|||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
"tmp/codeql_action_test/",
|
"tmp/codeql_action_test/",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
|
expectedFeatureEnablement,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import * as defaults from "./defaults.json";
|
|||||||
import {
|
import {
|
||||||
CODEQL_VERSION_ZSTD_BUNDLE,
|
CODEQL_VERSION_ZSTD_BUNDLE,
|
||||||
CodeQLDefaultVersionInfo,
|
CodeQLDefaultVersionInfo,
|
||||||
|
FeatureEnablement,
|
||||||
} from "./feature-flags";
|
} from "./feature-flags";
|
||||||
import { formatDuration, Logger } from "./logging";
|
import { formatDuration, Logger } from "./logging";
|
||||||
import * as tar from "./tar";
|
import * as tar from "./tar";
|
||||||
@@ -504,6 +505,7 @@ export const downloadCodeQL = async function (
|
|||||||
apiDetails: api.GitHubApiDetails,
|
apiDetails: api.GitHubApiDetails,
|
||||||
tarVersion: tar.TarVersion | undefined,
|
tarVersion: tar.TarVersion | undefined,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
codeqlFolder: string;
|
codeqlFolder: string;
|
||||||
@@ -538,6 +540,7 @@ export const downloadCodeQL = async function (
|
|||||||
{ "User-Agent": "CodeQL Action", ...headers },
|
{ "User-Agent": "CodeQL Action", ...headers },
|
||||||
tarVersion,
|
tarVersion,
|
||||||
tempDir,
|
tempDir,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -646,6 +649,7 @@ export async function setupCodeQLBundle(
|
|||||||
apiDetails: api.GitHubApiDetails,
|
apiDetails: api.GitHubApiDetails,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
|
features: FeatureEnablement,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
) {
|
) {
|
||||||
@@ -691,6 +695,7 @@ export async function setupCodeQLBundle(
|
|||||||
apiDetails,
|
apiDetails,
|
||||||
zstdAvailability.version,
|
zstdAvailability.version,
|
||||||
tempDir,
|
tempDir,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
toolsVersion = result.toolsVersion;
|
toolsVersion = result.toolsVersion;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import * as toolcache from "@actions/tool-cache";
|
|||||||
import { https } from "follow-redirects";
|
import { https } from "follow-redirects";
|
||||||
import { v4 as uuidV4 } from "uuid";
|
import { v4 as uuidV4 } from "uuid";
|
||||||
|
|
||||||
|
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||||
import { formatDuration, Logger } from "./logging";
|
import { formatDuration, Logger } from "./logging";
|
||||||
import * as tar from "./tar";
|
import * as tar from "./tar";
|
||||||
import { cleanUpGlob } from "./util";
|
import { cleanUpGlob } from "./util";
|
||||||
@@ -76,6 +77,7 @@ export async function downloadAndExtract(
|
|||||||
headers: OutgoingHttpHeaders,
|
headers: OutgoingHttpHeaders,
|
||||||
tarVersion: tar.TarVersion | undefined,
|
tarVersion: tar.TarVersion | undefined,
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
|
features: FeatureEnablement,
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
extractedBundlePath: string;
|
extractedBundlePath: string;
|
||||||
@@ -88,8 +90,12 @@ export async function downloadAndExtract(
|
|||||||
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
|
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
|
||||||
|
|
||||||
// TODO: Re-enable streaming when we have a more reliable way to respect proxy settings.
|
// TODO: Re-enable streaming when we have a more reliable way to respect proxy settings.
|
||||||
// eslint-disable-next-line no-constant-condition, no-constant-binary-expression
|
|
||||||
if (false && compressionMethod === "zstd" && process.platform === "linux") {
|
if (
|
||||||
|
(await features.getValue(Feature.ZstdBundleStreamingExtraction)) &&
|
||||||
|
compressionMethod === "zstd" &&
|
||||||
|
process.platform === "linux"
|
||||||
|
) {
|
||||||
logger.info(`Streaming the extraction of the CodeQL bundle.`);
|
logger.info(`Streaming the extraction of the CodeQL bundle.`);
|
||||||
|
|
||||||
const toolsInstallStart = performance.now();
|
const toolsInstallStart = performance.now();
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ async function combineSarifFilesUsingCLI(
|
|||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
|
features,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user