Enable zstd bundles on GHES and remove feature flag
This commit is contained in:
parent
48c3e26756
commit
33f2dc57a4
32 changed files with 82 additions and 154 deletions
4
lib/codeql.js
generated
4
lib/codeql.js
generated
|
|
@ -114,9 +114,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, features, logger, checkVersion) {
|
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, checkVersion) {
|
||||||
try {
|
try {
|
||||||
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger);
|
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, 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
20
lib/codeql.test.js
generated
20
lib/codeql.test.js
generated
|
|
@ -60,7 +60,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, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true), false);
|
: testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, (0, logging_1.getRunnerLogger)(true), 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 +97,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, testing_utils_1.createFeatures)([]), (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), 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 +112,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, testing_utils_1.createFeatures)([]), (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), 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 +133,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, testing_utils_1.createFeatures)([]), (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), 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 +161,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, testing_utils_1.createFeatures)([]), (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), 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 +184,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, testing_utils_1.createFeatures)([]), (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), 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 +204,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, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), 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 +228,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, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true), false);
|
}, (0, logging_1.getRunnerLogger)(true), 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 +249,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, testing_utils_1.createFeatures)([]), (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), 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 +273,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, testing_utils_1.createFeatures)([]), (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), 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
14
lib/feature-flags.js
generated
14
lib/feature-flags.js
generated
|
|
@ -63,8 +63,6 @@ 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["ZstdBundle"] = "zstd_bundle";
|
|
||||||
Feature["ZstdBundleStreamingExtraction"] = "zstd_bundle_streaming_extraction";
|
|
||||||
})(Feature || (exports.Feature = Feature = {}));
|
})(Feature || (exports.Feature = Feature = {}));
|
||||||
exports.featureConfig = {
|
exports.featureConfig = {
|
||||||
[Feature.ArtifactV4Upgrade]: {
|
[Feature.ArtifactV4Upgrade]: {
|
||||||
|
|
@ -129,18 +127,6 @@ exports.featureConfig = {
|
||||||
legacyApi: true,
|
legacyApi: true,
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
},
|
},
|
||||||
[Feature.ZstdBundle]: {
|
|
||||||
defaultValue: false,
|
|
||||||
envVar: "CODEQL_ACTION_ZSTD_BUNDLE",
|
|
||||||
// We haven't yet installed CodeQL when we check this feature flag, so we need to implement the
|
|
||||||
// version check separately.
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
[Feature.ZstdBundleStreamingExtraction]: {
|
|
||||||
defaultValue: false,
|
|
||||||
envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION",
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json";
|
exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json";
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
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, features, logger);
|
const initCodeQLResult = await (0, init_1.initCodeQL)((0, actions_util_1.getOptionalInput)("tools"), apiDetails, (0, actions_util_1.getTemporaryDirectory)(), gitHubVersion.type, codeQLDefaultVersionInfo, 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, features, logger) {
|
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, 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, features, logger, true);
|
const { codeql, toolsDownloadStatusReport, toolsSource, toolsVersion, zstdAvailability, } = await (0, codeql_1.setupCodeQL)(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, 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,gCAyCC;AAED,gCAgBC;AAED,0BAkCC;AAED,0DAeC;AAMD,sDAkBC;AAED,0EAkDC;AAhND,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,QAA2B,EAC3B,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,QAAQ,EACR,MAAM,EACN,IAAI,CACL,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC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C/E,yCAAyC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
||||||
25
lib/setup-codeql.js
generated
25
lib/setup-codeql.js
generated
|
|
@ -205,7 +205,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, features, logger) {
|
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, tarSupportsZstd, logger) {
|
||||||
if (toolsInput &&
|
if (toolsInput &&
|
||||||
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
|
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
|
||||||
!toolsInput.startsWith("http")) {
|
!toolsInput.startsWith("http")) {
|
||||||
|
|
@ -347,7 +347,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
||||||
}
|
}
|
||||||
if (!url) {
|
if (!url) {
|
||||||
url = await getCodeQLBundleDownloadURL(tagName, apiDetails, cliVersion !== undefined &&
|
url = await getCodeQLBundleDownloadURL(tagName, apiDetails, cliVersion !== undefined &&
|
||||||
(await useZstdBundle(cliVersion, features, tarSupportsZstd)), logger);
|
(await useZstdBundle(cliVersion, tarSupportsZstd)), logger);
|
||||||
}
|
}
|
||||||
if (cliVersion) {
|
if (cliVersion) {
|
||||||
logger.info(`Using CodeQL CLI version ${cliVersion} sourced from ${url} .`);
|
logger.info(`Using CodeQL CLI version ${cliVersion} sourced from ${url} .`);
|
||||||
|
|
@ -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, features, logger) {
|
const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVersion, apiDetails, tarVersion, tempDir, 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, features, logger);
|
const { extractedBundlePath, statusReport } = await (0, tools_download_1.downloadAndExtract)(codeqlURL, authorization, { "User-Agent": "CodeQL Action", ...headers }, tarVersion, tempDir, 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, features, logger) {
|
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
||||||
const zstdAvailability = await tar.isZstdAvailable(logger);
|
const zstdAvailability = await tar.isZstdAvailable(logger);
|
||||||
let zstdFailureReason;
|
let zstdFailureReason;
|
||||||
// If we think the installed version of tar supports zstd, try to use zstd,
|
// If we think the installed version of tar supports zstd, try to use zstd,
|
||||||
|
|
@ -473,7 +473,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
||||||
if (process.env.CODEQL_ACTION_FORCE_ZSTD_FAILURE === "true") {
|
if (process.env.CODEQL_ACTION_FORCE_ZSTD_FAILURE === "true") {
|
||||||
throw new Error("Failing since CODEQL_ACTION_FORCE_ZSTD_FAILURE is true.");
|
throw new Error("Failing since CODEQL_ACTION_FORCE_ZSTD_FAILURE is true.");
|
||||||
}
|
}
|
||||||
return await setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, zstdAvailability, true);
|
return await setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, zstdAvailability, true);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
zstdFailureReason = util.getErrorMessage(e) || "unknown error";
|
zstdFailureReason = util.getErrorMessage(e) || "unknown error";
|
||||||
|
|
@ -484,14 +484,14 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
||||||
logger.warning(`Failed to set up CodeQL tools with zstd. Falling back to gzipped version. Error: ${util.getErrorMessage(e)}`);
|
logger.warning(`Failed to set up CodeQL tools with zstd. Falling back to gzipped version. Error: ${util.getErrorMessage(e)}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const result = await setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, zstdAvailability, false);
|
const result = await setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, zstdAvailability, false);
|
||||||
if (result.toolsDownloadStatusReport && zstdFailureReason) {
|
if (result.toolsDownloadStatusReport && zstdFailureReason) {
|
||||||
result.toolsDownloadStatusReport.zstdFailureReason = zstdFailureReason;
|
result.toolsDownloadStatusReport.zstdFailureReason = zstdFailureReason;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
async function setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, zstdAvailability, useTarIfAvailable) {
|
async function setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, zstdAvailability, useTarIfAvailable) {
|
||||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, useTarIfAvailable, features, logger);
|
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, useTarIfAvailable, logger);
|
||||||
let codeqlFolder;
|
let codeqlFolder;
|
||||||
let toolsVersion = source.toolsVersion;
|
let toolsVersion = source.toolsVersion;
|
||||||
let toolsDownloadStatusReport;
|
let toolsDownloadStatusReport;
|
||||||
|
|
@ -509,7 +509,7 @@ async function setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, te
|
||||||
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, features, logger);
|
const result = await (0, exports.downloadCodeQL)(source.codeqlURL, source.bundleVersion, source.cliVersion, apiDetails, zstdAvailability.version, tempDir, logger);
|
||||||
toolsVersion = result.toolsVersion;
|
toolsVersion = result.toolsVersion;
|
||||||
codeqlFolder = result.codeqlFolder;
|
codeqlFolder = result.codeqlFolder;
|
||||||
toolsDownloadStatusReport = result.statusReport;
|
toolsDownloadStatusReport = result.statusReport;
|
||||||
|
|
@ -527,12 +527,11 @@ async function setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, te
|
||||||
zstdAvailability,
|
zstdAvailability,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function useZstdBundle(cliVersion, features, tarSupportsZstd) {
|
async function useZstdBundle(cliVersion, tarSupportsZstd) {
|
||||||
return (
|
return (
|
||||||
// In testing, gzip performs better than zstd on Windows.
|
// In testing, gzip performs better than zstd on Windows.
|
||||||
process.platform !== "win32" &&
|
process.platform !== "win32" &&
|
||||||
tarSupportsZstd &&
|
tarSupportsZstd &&
|
||||||
semver.gte(cliVersion, feature_flags_1.CODEQL_VERSION_ZSTD_BUNDLE) &&
|
semver.gte(cliVersion, feature_flags_1.CODEQL_VERSION_ZSTD_BUNDLE));
|
||||||
!!(await features.getValue(feature_flags_1.Feature.ZstdBundle)));
|
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=setup-codeql.js.map
|
//# sourceMappingURL=setup-codeql.js.map
|
||||||
File diff suppressed because one or more lines are too long
10
lib/setup-codeql.test.js
generated
10
lib/setup-codeql.test.js
generated
|
|
@ -79,7 +79,7 @@ ava_1.default.beforeEach(() => {
|
||||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||||
const tagName = "codeql-bundle-v1.2.3";
|
const tagName = "codeql-bundle-v1.2.3";
|
||||||
(0, testing_utils_1.mockBundleDownloadApi)({ tagName });
|
(0, testing_utils_1.mockBundleDownloadApi)({ tagName });
|
||||||
const source = await setupCodeql.getCodeQLSource(`https://github.com/github/codeql-action/releases/download/${tagName}/codeql-bundle-linux64.tar.gz`, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, false, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const source = await setupCodeql.getCodeQLSource(`https://github.com/github/codeql-action/releases/download/${tagName}/codeql-bundle-linux64.tar.gz`, testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, false, (0, logging_1.getRunnerLogger)(true));
|
||||||
t.is(source.sourceType, "download");
|
t.is(source.sourceType, "download");
|
||||||
t.is(source["cliVersion"], "1.2.3");
|
t.is(source["cliVersion"], "1.2.3");
|
||||||
});
|
});
|
||||||
|
|
@ -87,7 +87,7 @@ ava_1.default.beforeEach(() => {
|
||||||
(0, ava_1.default)("getCodeQLSource correctly returns bundled CLI version when tools == linked", async (t) => {
|
(0, ava_1.default)("getCodeQLSource correctly returns bundled CLI version when tools == linked", async (t) => {
|
||||||
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 source = await setupCodeql.getCodeQLSource("linked", testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, false, (0, testing_utils_1.createFeatures)([]), (0, logging_1.getRunnerLogger)(true));
|
const source = await setupCodeql.getCodeQLSource("linked", testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, false, (0, logging_1.getRunnerLogger)(true));
|
||||||
t.is(source.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
t.is(source.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
||||||
t.is(source.sourceType, "download");
|
t.is(source.sourceType, "download");
|
||||||
});
|
});
|
||||||
|
|
@ -97,7 +97,7 @@ ava_1.default.beforeEach(() => {
|
||||||
const logger = (0, testing_utils_1.getRecordingLogger)(loggedMessages);
|
const logger = (0, testing_utils_1.getRecordingLogger)(loggedMessages);
|
||||||
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 source = await setupCodeql.getCodeQLSource("latest", testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, false, (0, testing_utils_1.createFeatures)([]), logger);
|
const source = await setupCodeql.getCodeQLSource("latest", testing_utils_1.SAMPLE_DEFAULT_CLI_VERSION, testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, util_1.GitHubVariant.DOTCOM, false, logger);
|
||||||
// First, ensure that the CLI version is the linked version, so that backwards
|
// First, ensure that the CLI version is the linked version, so that backwards
|
||||||
// compatibility is maintained.
|
// compatibility is maintained.
|
||||||
t.is(source.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
t.is(source.toolsVersion, testing_utils_1.LINKED_CLI_VERSION.cliVersion);
|
||||||
|
|
@ -127,7 +127,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, (0, testing_utils_1.createFeatures)([]), logger);
|
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);
|
||||||
// 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 +158,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, (0, testing_utils_1.createFeatures)([]), logger);
|
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);
|
||||||
// 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
18
lib/testing-utils.js
generated
18
lib/testing-utils.js
generated
|
|
@ -243,13 +243,17 @@ function mockBundleDownloadApi({ apiDetails = exports.SAMPLE_DOTCOM_API_DETAILS,
|
||||||
? "linux64"
|
? "linux64"
|
||||||
: "osx64";
|
: "osx64";
|
||||||
const baseUrl = apiDetails?.url ?? "https://example.com";
|
const baseUrl = apiDetails?.url ?? "https://example.com";
|
||||||
const relativeUrl = apiDetails
|
const bundleUrls = ["tar.gz", "tar.zst"].map((extension) => {
|
||||||
? `/${repo}/releases/download/${tagName}/codeql-bundle${platformSpecific ? `-${platform}` : ""}.tar.gz`
|
const relativeUrl = apiDetails
|
||||||
: `/download/${tagName}/codeql-bundle.tar.gz`;
|
? `/${repo}/releases/download/${tagName}/codeql-bundle${platformSpecific ? `-${platform}` : ""}.${extension}`
|
||||||
(0, nock_1.default)(baseUrl)
|
: `/download/${tagName}/codeql-bundle.${extension}`;
|
||||||
.get(relativeUrl)
|
(0, nock_1.default)(baseUrl)
|
||||||
.replyWithFile(200, path_1.default.join(__dirname, `/../src/testdata/codeql-bundle${isPinned ? "-pinned" : ""}.tar.gz`));
|
.get(relativeUrl)
|
||||||
return `${baseUrl}${relativeUrl}`;
|
.replyWithFile(200, path_1.default.join(__dirname, `/../src/testdata/codeql-bundle${isPinned ? "-pinned" : ""}.${extension}`));
|
||||||
|
return `${baseUrl}${relativeUrl}`;
|
||||||
|
});
|
||||||
|
// Choose an arbitrary URL to return
|
||||||
|
return bundleUrls[0];
|
||||||
}
|
}
|
||||||
function createTestConfig(overrides) {
|
function createTestConfig(overrides) {
|
||||||
return Object.assign({}, {
|
return Object.assign({}, {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
7
lib/tools-download.js
generated
7
lib/tools-download.js
generated
|
|
@ -30,7 +30,6 @@ 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");
|
||||||
|
|
@ -54,12 +53,10 @@ function makeStreamedToolsDownloadDurations(combinedDurationMs) {
|
||||||
streamExtraction: true,
|
streamExtraction: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async function downloadAndExtract(codeqlURL, authorization, headers, tarVersion, tempDir, features, logger) {
|
async function downloadAndExtract(codeqlURL, authorization, headers, tarVersion, tempDir, 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);
|
||||||
if (compressionMethod === "zstd" &&
|
if (compressionMethod === "zstd" && process.platform === "linux") {
|
||||||
process.platform === "linux" &&
|
|
||||||
(await features.getValue(feature_flags_1.Feature.ZstdBundleStreamingExtraction))) {
|
|
||||||
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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,gDAuGC;AA/KD,2CAA6B;AAC7B,2CAAyC;AAEzC,+DAAiD;AACjD,uDAAyC;AACzC,+BAAoC;AAEpC,mDAA6D;AAC7D,uCAAmD;AACnD,2CAA6B;AAC7B,iCAAqC;AAErC;;GAEG;AACU,QAAA,8BAA8B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,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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, features, logger);
|
apiDetails, tempDir, gitHubVersion.type, codeQLDefaultVersionInfo, 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
|
|
@ -69,8 +69,6 @@ async function installIntoToolcache({
|
||||||
cliVersion !== undefined
|
cliVersion !== undefined
|
||||||
? { cliVersion, tagName }
|
? { cliVersion, tagName }
|
||||||
: SAMPLE_DEFAULT_CLI_VERSION,
|
: SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -130,8 +128,6 @@ test("downloads and caches explicitly requested bundles that aren't in the toolc
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -158,8 +154,6 @@ test("caches semantically versioned bundles using their semantic version number"
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -193,8 +187,6 @@ test("downloads an explicitly requested bundle even if a different version is ca
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -239,8 +231,6 @@ for (const {
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -279,8 +269,6 @@ for (const toolcacheVersion of [
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -313,8 +301,6 @@ test(`uses a cached bundle when no tools input is given on GHES`, async (t) => {
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
},
|
},
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -351,8 +337,6 @@ test(`downloads bundle if only an unpinned version is cached on GHES`, async (t)
|
||||||
cliVersion: defaults.cliVersion,
|
cliVersion: defaults.cliVersion,
|
||||||
tagName: defaults.bundleVersion,
|
tagName: defaults.bundleVersion,
|
||||||
},
|
},
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -386,8 +370,6 @@ test('downloads bundle if "latest" tools specified but not cached', async (t) =>
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
@ -424,8 +406,6 @@ test("bundle URL from another repo is cached as 0.0.0-bundleVersion", async (t)
|
||||||
tmpDir,
|
tmpDir,
|
||||||
util.GitHubVariant.DOTCOM,
|
util.GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
|
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,6 @@ export async function setupCodeQL(
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
features: FeatureEnablement,
|
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
checkVersion: boolean,
|
checkVersion: boolean,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
|
|
@ -366,7 +365,6 @@ export async function setupCodeQL(
|
||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,6 @@ 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",
|
||||||
ZstdBundle = "zstd_bundle",
|
|
||||||
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const featureConfig: Record<
|
export const featureConfig: Record<
|
||||||
|
|
@ -156,18 +154,6 @@ export const featureConfig: Record<
|
||||||
legacyApi: true,
|
legacyApi: true,
|
||||||
minimumVersion: undefined,
|
minimumVersion: undefined,
|
||||||
},
|
},
|
||||||
[Feature.ZstdBundle]: {
|
|
||||||
defaultValue: false,
|
|
||||||
envVar: "CODEQL_ACTION_ZSTD_BUNDLE",
|
|
||||||
// We haven't yet installed CodeQL when we check this feature flag, so we need to implement the
|
|
||||||
// version check separately.
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
[Feature.ZstdBundleStreamingExtraction]: {
|
|
||||||
defaultValue: false,
|
|
||||||
envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION",
|
|
||||||
minimumVersion: undefined,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,6 @@ 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, FeatureEnablement } from "./feature-flags";
|
import { CodeQLDefaultVersionInfo } 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,7 +24,6 @@ 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,7 +45,6 @@ export async function initCodeQL(
|
||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import {
|
||||||
LoggedMessage,
|
LoggedMessage,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
createFeatures,
|
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
mockBundleDownloadApi,
|
mockBundleDownloadApi,
|
||||||
setupActionsVars,
|
setupActionsVars,
|
||||||
|
|
@ -91,7 +90,6 @@ test("getCodeQLSource sets CLI version for a semver tagged bundle", async (t) =>
|
||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -109,7 +107,6 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == linked
|
||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
createFeatures([]),
|
|
||||||
getRunnerLogger(true),
|
getRunnerLogger(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -130,7 +127,6 @@ test("getCodeQLSource correctly returns bundled CLI version when tools == latest
|
||||||
SAMPLE_DOTCOM_API_DETAILS,
|
SAMPLE_DOTCOM_API_DETAILS,
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
false,
|
false,
|
||||||
createFeatures([]),
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -179,7 +175,6 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to use
|
||||||
"tmp/codeql_action_test/",
|
"tmp/codeql_action_test/",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
createFeatures([]),
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -230,7 +225,6 @@ test("setupCodeQLBundle logs the CodeQL CLI version being used when asked to dow
|
||||||
"tmp/codeql_action_test/",
|
"tmp/codeql_action_test/",
|
||||||
GitHubVariant.DOTCOM,
|
GitHubVariant.DOTCOM,
|
||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
createFeatures([]),
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ import * as defaults from "./defaults.json";
|
||||||
import {
|
import {
|
||||||
CODEQL_VERSION_ZSTD_BUNDLE,
|
CODEQL_VERSION_ZSTD_BUNDLE,
|
||||||
CodeQLDefaultVersionInfo,
|
CodeQLDefaultVersionInfo,
|
||||||
Feature,
|
|
||||||
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";
|
||||||
|
|
@ -261,7 +259,6 @@ export async function getCodeQLSource(
|
||||||
apiDetails: api.GitHubApiDetails,
|
apiDetails: api.GitHubApiDetails,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
tarSupportsZstd: boolean,
|
tarSupportsZstd: boolean,
|
||||||
features: FeatureEnablement,
|
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<CodeQLToolsSource> {
|
): Promise<CodeQLToolsSource> {
|
||||||
if (
|
if (
|
||||||
|
|
@ -458,7 +455,7 @@ export async function getCodeQLSource(
|
||||||
tagName!,
|
tagName!,
|
||||||
apiDetails,
|
apiDetails,
|
||||||
cliVersion !== undefined &&
|
cliVersion !== undefined &&
|
||||||
(await useZstdBundle(cliVersion, features, tarSupportsZstd)),
|
(await useZstdBundle(cliVersion, tarSupportsZstd)),
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -507,7 +504,6 @@ 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;
|
||||||
|
|
@ -542,7 +538,6 @@ export const downloadCodeQL = async function (
|
||||||
{ "User-Agent": "CodeQL Action", ...headers },
|
{ "User-Agent": "CodeQL Action", ...headers },
|
||||||
tarVersion,
|
tarVersion,
|
||||||
tempDir,
|
tempDir,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -653,7 +648,6 @@ export async function setupCodeQLBundle(
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
features: FeatureEnablement,
|
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<SetupCodeQLResult> {
|
): Promise<SetupCodeQLResult> {
|
||||||
const zstdAvailability = await tar.isZstdAvailable(logger);
|
const zstdAvailability = await tar.isZstdAvailable(logger);
|
||||||
|
|
@ -675,7 +669,6 @@ export async function setupCodeQLBundle(
|
||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
zstdAvailability,
|
zstdAvailability,
|
||||||
true,
|
true,
|
||||||
|
|
@ -700,7 +693,6 @@ export async function setupCodeQLBundle(
|
||||||
tempDir,
|
tempDir,
|
||||||
variant,
|
variant,
|
||||||
defaultCliVersion,
|
defaultCliVersion,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
zstdAvailability,
|
zstdAvailability,
|
||||||
false,
|
false,
|
||||||
|
|
@ -717,7 +709,6 @@ async function setupCodeQLBundleWithCompressionMethod(
|
||||||
tempDir: string,
|
tempDir: string,
|
||||||
variant: util.GitHubVariant,
|
variant: util.GitHubVariant,
|
||||||
defaultCliVersion: CodeQLDefaultVersionInfo,
|
defaultCliVersion: CodeQLDefaultVersionInfo,
|
||||||
features: FeatureEnablement,
|
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
zstdAvailability: tar.ZstdAvailability,
|
zstdAvailability: tar.ZstdAvailability,
|
||||||
useTarIfAvailable: boolean,
|
useTarIfAvailable: boolean,
|
||||||
|
|
@ -728,7 +719,6 @@ async function setupCodeQLBundleWithCompressionMethod(
|
||||||
apiDetails,
|
apiDetails,
|
||||||
variant,
|
variant,
|
||||||
useTarIfAvailable,
|
useTarIfAvailable,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -763,7 +753,6 @@ async function setupCodeQLBundleWithCompressionMethod(
|
||||||
apiDetails,
|
apiDetails,
|
||||||
zstdAvailability.version,
|
zstdAvailability.version,
|
||||||
tempDir,
|
tempDir,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
toolsVersion = result.toolsVersion;
|
toolsVersion = result.toolsVersion;
|
||||||
|
|
@ -786,14 +775,12 @@ async function setupCodeQLBundleWithCompressionMethod(
|
||||||
|
|
||||||
async function useZstdBundle(
|
async function useZstdBundle(
|
||||||
cliVersion: string,
|
cliVersion: string,
|
||||||
features: FeatureEnablement,
|
|
||||||
tarSupportsZstd: boolean,
|
tarSupportsZstd: boolean,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
return (
|
return (
|
||||||
// In testing, gzip performs better than zstd on Windows.
|
// In testing, gzip performs better than zstd on Windows.
|
||||||
process.platform !== "win32" &&
|
process.platform !== "win32" &&
|
||||||
tarSupportsZstd &&
|
tarSupportsZstd &&
|
||||||
semver.gte(cliVersion, CODEQL_VERSION_ZSTD_BUNDLE) &&
|
semver.gte(cliVersion, CODEQL_VERSION_ZSTD_BUNDLE)
|
||||||
!!(await features.getValue(Feature.ZstdBundle))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
src/testdata/codeql-bundle-pinned.tar.zst
vendored
Normal file
BIN
src/testdata/codeql-bundle-pinned.tar.zst
vendored
Normal file
Binary file not shown.
BIN
src/testdata/codeql-bundle.tar.zst
vendored
Normal file
BIN
src/testdata/codeql-bundle.tar.zst
vendored
Normal file
Binary file not shown.
|
|
@ -290,23 +290,30 @@ export function mockBundleDownloadApi({
|
||||||
: "osx64";
|
: "osx64";
|
||||||
|
|
||||||
const baseUrl = apiDetails?.url ?? "https://example.com";
|
const baseUrl = apiDetails?.url ?? "https://example.com";
|
||||||
const relativeUrl = apiDetails
|
|
||||||
? `/${repo}/releases/download/${tagName}/codeql-bundle${
|
|
||||||
platformSpecific ? `-${platform}` : ""
|
|
||||||
}.tar.gz`
|
|
||||||
: `/download/${tagName}/codeql-bundle.tar.gz`;
|
|
||||||
|
|
||||||
nock(baseUrl)
|
const bundleUrls = ["tar.gz", "tar.zst"].map((extension) => {
|
||||||
.get(relativeUrl)
|
const relativeUrl = apiDetails
|
||||||
.replyWithFile(
|
? `/${repo}/releases/download/${tagName}/codeql-bundle${
|
||||||
200,
|
platformSpecific ? `-${platform}` : ""
|
||||||
path.join(
|
}.${extension}`
|
||||||
__dirname,
|
: `/download/${tagName}/codeql-bundle.${extension}`;
|
||||||
`/../src/testdata/codeql-bundle${isPinned ? "-pinned" : ""}.tar.gz`,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return `${baseUrl}${relativeUrl}`;
|
nock(baseUrl)
|
||||||
|
.get(relativeUrl)
|
||||||
|
.replyWithFile(
|
||||||
|
200,
|
||||||
|
path.join(
|
||||||
|
__dirname,
|
||||||
|
`/../src/testdata/codeql-bundle${
|
||||||
|
isPinned ? "-pinned" : ""
|
||||||
|
}.${extension}`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return `${baseUrl}${relativeUrl}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Choose an arbitrary URL to return
|
||||||
|
return bundleUrls[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createTestConfig(overrides: Partial<Config>): Config {
|
export function createTestConfig(overrides: Partial<Config>): Config {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ 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";
|
||||||
|
|
@ -77,7 +76,6 @@ 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;
|
||||||
|
|
@ -89,11 +87,7 @@ export async function downloadAndExtract(
|
||||||
|
|
||||||
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
|
const compressionMethod = tar.inferCompressionMethod(codeqlURL);
|
||||||
|
|
||||||
if (
|
if (compressionMethod === "zstd" && process.platform === "linux") {
|
||||||
compressionMethod === "zstd" &&
|
|
||||||
process.platform === "linux" &&
|
|
||||||
(await features.getValue(Feature.ZstdBundleStreamingExtraction))
|
|
||||||
) {
|
|
||||||
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,7 +221,6 @@ async function combineSarifFilesUsingCLI(
|
||||||
tempDir,
|
tempDir,
|
||||||
gitHubVersion.type,
|
gitHubVersion.type,
|
||||||
codeQLDefaultVersionInfo,
|
codeQLDefaultVersionInfo,
|
||||||
features,
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue