Add detected tar version to telemetry

This commit is contained in:
Henry Mercer
2024-08-16 12:18:36 +01:00
parent 3e870d5ac3
commit 5e7ede04e0
6 changed files with 43 additions and 24 deletions

9
lib/setup-codeql.js generated
View File

@@ -509,10 +509,13 @@ async function setupCodeQLBundleWithZstdOption(toolsInput, apiDetails, tempDir,
* @returns the path to the extracted bundle, and the version of the tools
*/
async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, features, logger) {
let tarVersion = undefined;
let zstdError = undefined;
if (!toolsInput && (await features.getValue(feature_flags_1.Feature.ZstdBundle))) {
try {
if (await tar.isZstdAvailable(logger)) {
const availableResult = await tar.isZstdAvailable(logger);
tarVersion = availableResult.version;
if (availableResult.available) {
return await setupCodeQLBundleWithZstdOption(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, true, logger);
}
else {
@@ -527,9 +530,7 @@ async function setupCodeQLBundle(toolsInput, apiDetails, tempDir, variant, defau
}
}
const result = await setupCodeQLBundleWithZstdOption(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, false, logger);
if (zstdError) {
result.toolsDownloadStatusReport = Object.assign({}, result.toolsDownloadStatusReport, { zstdError: (0, util_1.wrapError)(zstdError).message });
}
result.toolsDownloadStatusReport = Object.assign({}, result.toolsDownloadStatusReport, tarVersion ? { tarVersion } : {}, zstdError ? { zstdError: (0, util_1.wrapError)(zstdError).message } : {});
return result;
}
async function cleanUpGlob(glob, name, logger) {