Experiment with asking tar to figure out the decompression method

This commit is contained in:
Henry Mercer 2024-08-13 12:41:15 +01:00
parent b43ac1c23f
commit e2572269a1
3 changed files with 16 additions and 3 deletions

8
lib/setup-codeql.js generated
View file

@ -397,7 +397,7 @@ const downloadCodeQL = async function (codeqlURL, maybeBundleVersion, maybeCliVe
logger.debug(`Finished downloading CodeQL bundle to ${archivedBundlePath} (${downloadDurationMs} ms).`);
logger.debug("Extracting CodeQL bundle.");
const extractionStart = perf_hooks_1.performance.now();
const extractedBundlePath = await toolcache.extractTar(archivedBundlePath);
const extractedBundlePath = await extractBundle(archivedBundlePath);
const extractionDurationMs = Math.round(perf_hooks_1.performance.now() - extractionStart);
logger.debug(`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionDurationMs} ms).`);
await cleanUpGlob(archivedBundlePath, "CodeQL bundle archive", logger);
@ -520,4 +520,10 @@ async function cleanUpGlob(glob, name, logger) {
logger.warning(`Failed to clean up ${name}: ${e}.`);
}
}
async function extractBundle(archivedBundlePath) {
if (archivedBundlePath.endsWith(".tar.gz")) {
return await toolcache.extractTar(archivedBundlePath);
}
return await toolcache.extractTar(archivedBundlePath, undefined, "x");
}
//# sourceMappingURL=setup-codeql.js.map

File diff suppressed because one or more lines are too long

View file

@ -526,7 +526,7 @@ export const downloadCodeQL = async function (
logger.debug("Extracting CodeQL bundle.");
const extractionStart = performance.now();
const extractedBundlePath = await toolcache.extractTar(archivedBundlePath);
const extractedBundlePath = await extractBundle(archivedBundlePath);
const extractionDurationMs = Math.round(performance.now() - extractionStart);
logger.debug(
`Finished extracting CodeQL bundle to ${extractedBundlePath} (${extractionDurationMs} ms).`,
@ -705,3 +705,10 @@ async function cleanUpGlob(glob: string, name: string, logger: Logger) {
logger.warning(`Failed to clean up ${name}: ${e}.`);
}
}
async function extractBundle(archivedBundlePath: string): Promise<string> {
if (archivedBundlePath.endsWith(".tar.gz")) {
return await toolcache.extractTar(archivedBundlePath);
}
return await toolcache.extractTar(archivedBundlePath, undefined, "x");
}