Fall back to gzipped bundles

This commit is contained in:
Henry Mercer
2024-08-13 13:55:19 +01:00
parent 8e444360fd
commit d277fb19ed
9 changed files with 108 additions and 46 deletions

19
lib/codeql.js generated
View File

@@ -105,6 +105,23 @@ exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = "2.15.0";
* Versions 2.15.2+ of the CodeQL CLI support the `--sarif-include-query-help` option.
*/
const CODEQL_VERSION_INCLUDE_QUERY_HELP = "2.15.2";
async function setupCodeQLBundlePreferringZstd(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
let zstdError = undefined;
if (await features.getValue(feature_flags_1.Feature.ZstdBundle)) {
try {
return await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, true, logger);
}
catch (e) {
logger.info("Failed to set up bundle compressed using zstd, falling back to bundle compressed using gzip.");
zstdError = e;
}
}
const result = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, false, logger);
if (zstdError) {
result.toolsDownloadStatusReport = Object.assign({}, result.toolsDownloadStatusReport, { zstdError: (0, util_1.wrapError)(zstdError).message });
}
return result;
}
/**
* Set up CodeQL CLI access.
*
@@ -120,7 +137,7 @@ const CODEQL_VERSION_INCLUDE_QUERY_HELP = "2.15.2";
*/
async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger, checkVersion) {
try {
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, } = await setupCodeql.setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger);
const { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion, } = await setupCodeQLBundlePreferringZstd(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger);
let codeqlCmd = path.join(codeqlFolder, "codeql", "codeql");
if (process.platform === "win32") {
codeqlCmd += ".exe";