mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Remove fallback to gzip
Data shows it is unneeded
This commit is contained in:
29
lib/setup-codeql.js
generated
29
lib/setup-codeql.js
generated
@@ -464,34 +464,7 @@ function getCanonicalToolcacheVersion(cliVersion, bundleVersion, logger) {
|
||||
*/
|
||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
||||
const zstdAvailability = await tar.isZstdAvailable(logger);
|
||||
let zstdFailureReason;
|
||||
// If we think the installed version of tar supports zstd, try to use zstd,
|
||||
// but be prepared to fall back to gzip in case we were wrong.
|
||||
if (zstdAvailability.available) {
|
||||
try {
|
||||
// To facilitate testing the fallback, fail here if a testing environment variable is set.
|
||||
if (process.env.CODEQL_ACTION_FORCE_ZSTD_FAILURE === "true") {
|
||||
throw new Error("Failing since CODEQL_ACTION_FORCE_ZSTD_FAILURE is true.");
|
||||
}
|
||||
return await setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, zstdAvailability, true);
|
||||
}
|
||||
catch (e) {
|
||||
zstdFailureReason = util.getErrorMessage(e) || "unknown error";
|
||||
if (e instanceof actions_util_1.CommandInvocationError) {
|
||||
zstdFailureReason += ` Full error: ${e.stderr}`;
|
||||
logger.debug(`Invocation output the following to stderr: ${e.stderr}`);
|
||||
}
|
||||
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, logger, zstdAvailability, false);
|
||||
if (result.toolsDownloadStatusReport && zstdFailureReason) {
|
||||
result.toolsDownloadStatusReport.zstdFailureReason = zstdFailureReason;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async function setupCodeQLBundleWithCompressionMethod(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger, zstdAvailability, useTarIfAvailable) {
|
||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, useTarIfAvailable, logger);
|
||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, zstdAvailability.available, logger);
|
||||
let codeqlFolder;
|
||||
let toolsVersion = source.toolsVersion;
|
||||
let toolsDownloadStatusReport;
|
||||
|
||||
Reference in New Issue
Block a user