Determine zstd availability earlier on to simplify log
This commit is contained in:
parent
db98c27941
commit
a7a6a6951e
17 changed files with 115 additions and 47 deletions
19
lib/setup-codeql.js
generated
19
lib/setup-codeql.js
generated
|
|
@ -198,7 +198,7 @@ async function findOverridingToolsInCache(humanReadableVersion, logger) {
|
|||
}
|
||||
return undefined;
|
||||
}
|
||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, features, logger) {
|
||||
async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, zstdAvailability, features, logger) {
|
||||
if (toolsInput &&
|
||||
!CODEQL_BUNDLE_VERSION_ALIAS.includes(toolsInput) &&
|
||||
!toolsInput.startsWith("http")) {
|
||||
|
|
@ -341,7 +341,7 @@ async function getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, varian
|
|||
}
|
||||
if (!url) {
|
||||
url = await getCodeQLBundleDownloadURL(tagName, apiDetails, cliVersion !== undefined &&
|
||||
(await useZstdBundle(cliVersion, features, logger)), logger);
|
||||
(await useZstdBundle(cliVersion, features, zstdAvailability)), logger);
|
||||
}
|
||||
if (cliVersion) {
|
||||
logger.info(`Using CodeQL CLI version ${cliVersion} sourced from ${url}.`);
|
||||
|
|
@ -478,7 +478,8 @@ function getCanonicalToolcacheVersion(cliVersion, bundleVersion, logger) {
|
|||
* @returns the path to the extracted bundle, and the version of the tools
|
||||
*/
|
||||
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
|
||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, features, logger);
|
||||
const zstdAvailability = await tar.isZstdAvailable(logger);
|
||||
const source = await getCodeQLSource(toolsInput, defaultCliVersion, apiDetails, variant, zstdAvailability, features, logger);
|
||||
let codeqlFolder;
|
||||
let toolsVersion = source.toolsVersion;
|
||||
let toolsDownloadStatusReport;
|
||||
|
|
@ -506,7 +507,13 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
|
|||
default:
|
||||
util.assertNever(source);
|
||||
}
|
||||
return { codeqlFolder, toolsDownloadStatusReport, toolsSource, toolsVersion };
|
||||
return {
|
||||
codeqlFolder,
|
||||
toolsDownloadStatusReport,
|
||||
toolsSource,
|
||||
toolsVersion,
|
||||
zstdAvailability,
|
||||
};
|
||||
}
|
||||
async function cleanUpGlob(glob, name, logger) {
|
||||
logger.debug(`Cleaning up ${name}.`);
|
||||
|
|
@ -531,9 +538,9 @@ function sanitizeUrlForStatusReport(url) {
|
|||
? url
|
||||
: "sanitized-value";
|
||||
}
|
||||
async function useZstdBundle(cliVersion, features, logger) {
|
||||
async function useZstdBundle(cliVersion, features, zstdAvailability) {
|
||||
return (semver.gte(cliVersion, "2.19.0") &&
|
||||
!!(await features.getValue(feature_flags_1.Feature.ZstdBundle)) &&
|
||||
(await tar.isZstdAvailable(logger)).available);
|
||||
zstdAvailability.available);
|
||||
}
|
||||
//# sourceMappingURL=setup-codeql.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue