Enablement: Move TRAP caching check after overlay

This commit is contained in:
Henry Mercer
2026-03-11 19:21:17 +00:00
parent b0f877255d
commit b04e63ffdf
15 changed files with 2617 additions and 2594 deletions

File diff suppressed because it is too large Load Diff

375
lib/analyze-action.js generated

File diff suppressed because it is too large Load Diff

345
lib/autobuild-action.js generated

File diff suppressed because it is too large Load Diff

593
lib/init-action-post.js generated

File diff suppressed because it is too large Load Diff

467
lib/init-action.js generated

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

319
lib/upload-lib.js generated
View File

@@ -21321,7 +21321,7 @@ var require_core = __commonJS({
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.platform = exports2.toPlatformPath = exports2.toWin32Path = exports2.toPosixPath = exports2.markdownSummary = exports2.summary = exports2.ExitCode = void 0;
exports2.exportVariable = exportVariable6;
exports2.exportVariable = exportVariable7;
exports2.setSecret = setSecret;
exports2.addPath = addPath;
exports2.getInput = getInput2;
@@ -21353,7 +21353,7 @@ var require_core = __commonJS({
ExitCode2[ExitCode2["Success"] = 0] = "Success";
ExitCode2[ExitCode2["Failure"] = 1] = "Failure";
})(ExitCode || (exports2.ExitCode = ExitCode = {}));
function exportVariable6(name, val) {
function exportVariable7(name, val) {
const convertedVal = (0, utils_1.toCommandValue)(val);
process.env[name] = convertedVal;
const filePath = process.env["GITHUB_ENV"] || "";
@@ -48747,7 +48747,7 @@ var require_internal_glob_options_helper = __commonJS({
})();
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.getOptions = getOptions;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
function getOptions(copy) {
const result = {
followSymbolicLinks: true,
@@ -48759,23 +48759,23 @@ var require_internal_glob_options_helper = __commonJS({
if (copy) {
if (typeof copy.followSymbolicLinks === "boolean") {
result.followSymbolicLinks = copy.followSymbolicLinks;
core13.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`);
core14.debug(`followSymbolicLinks '${result.followSymbolicLinks}'`);
}
if (typeof copy.implicitDescendants === "boolean") {
result.implicitDescendants = copy.implicitDescendants;
core13.debug(`implicitDescendants '${result.implicitDescendants}'`);
core14.debug(`implicitDescendants '${result.implicitDescendants}'`);
}
if (typeof copy.matchDirectories === "boolean") {
result.matchDirectories = copy.matchDirectories;
core13.debug(`matchDirectories '${result.matchDirectories}'`);
core14.debug(`matchDirectories '${result.matchDirectories}'`);
}
if (typeof copy.omitBrokenSymbolicLinks === "boolean") {
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
core13.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
core14.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
}
if (typeof copy.excludeHiddenFiles === "boolean") {
result.excludeHiddenFiles = copy.excludeHiddenFiles;
core13.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
core14.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
}
}
return result;
@@ -50403,7 +50403,7 @@ var require_internal_globber = __commonJS({
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.DefaultGlobber = void 0;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var fs13 = __importStar2(require("fs"));
var globOptionsHelper = __importStar2(require_internal_glob_options_helper());
var path12 = __importStar2(require("path"));
@@ -50456,7 +50456,7 @@ var require_internal_globber = __commonJS({
}
const stack = [];
for (const searchPath of patternHelper.getSearchPaths(patterns)) {
core13.debug(`Search path '${searchPath}'`);
core14.debug(`Search path '${searchPath}'`);
try {
yield __await2(fs13.promises.lstat(searchPath));
} catch (err) {
@@ -50531,7 +50531,7 @@ var require_internal_globber = __commonJS({
} catch (err) {
if (err.code === "ENOENT") {
if (options.omitBrokenSymbolicLinks) {
core13.debug(`Broken symlink '${item.path}'`);
core14.debug(`Broken symlink '${item.path}'`);
return void 0;
}
throw new Error(`No information found for the path '${item.path}'. This may indicate a broken symbolic link.`);
@@ -50547,7 +50547,7 @@ var require_internal_globber = __commonJS({
traversalChain.pop();
}
if (traversalChain.some((x) => x === realPath)) {
core13.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`);
core14.debug(`Symlink cycle detected for path '${item.path}' and realpath '${realPath}'`);
return void 0;
}
traversalChain.push(realPath);
@@ -50650,7 +50650,7 @@ var require_internal_hash_files = __commonJS({
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.hashFiles = hashFiles;
var crypto2 = __importStar2(require("crypto"));
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var fs13 = __importStar2(require("fs"));
var stream2 = __importStar2(require("stream"));
var util = __importStar2(require("util"));
@@ -50659,7 +50659,7 @@ var require_internal_hash_files = __commonJS({
return __awaiter2(this, arguments, void 0, function* (globber, currentWorkspace, verbose = false) {
var _a, e_1, _b, _c;
var _d;
const writeDelegate = verbose ? core13.info : core13.debug;
const writeDelegate = verbose ? core14.info : core14.debug;
let hasMatch = false;
const githubWorkspace = currentWorkspace ? currentWorkspace : (_d = process.env["GITHUB_WORKSPACE"]) !== null && _d !== void 0 ? _d : process.cwd();
const result = crypto2.createHash("sha256");
@@ -52050,7 +52050,7 @@ var require_cacheUtils = __commonJS({
exports2.assertDefined = assertDefined;
exports2.getCacheVersion = getCacheVersion;
exports2.getRuntimeToken = getRuntimeToken;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var exec = __importStar2(require_exec());
var glob = __importStar2(require_glob());
var io6 = __importStar2(require_io());
@@ -52101,7 +52101,7 @@ var require_cacheUtils = __commonJS({
_e = false;
const file = _c;
const relativeFile = path12.relative(workspace, file).replace(new RegExp(`\\${path12.sep}`, "g"), "/");
core13.debug(`Matched: ${relativeFile}`);
core14.debug(`Matched: ${relativeFile}`);
if (relativeFile === "") {
paths.push(".");
} else {
@@ -52129,7 +52129,7 @@ var require_cacheUtils = __commonJS({
return __awaiter2(this, arguments, void 0, function* (app, additionalArgs = []) {
let versionOutput = "";
additionalArgs.push("--version");
core13.debug(`Checking ${app} ${additionalArgs.join(" ")}`);
core14.debug(`Checking ${app} ${additionalArgs.join(" ")}`);
try {
yield exec.exec(`${app}`, additionalArgs, {
ignoreReturnCode: true,
@@ -52140,10 +52140,10 @@ var require_cacheUtils = __commonJS({
}
});
} catch (err) {
core13.debug(err.message);
core14.debug(err.message);
}
versionOutput = versionOutput.trim();
core13.debug(versionOutput);
core14.debug(versionOutput);
return versionOutput;
});
}
@@ -52151,7 +52151,7 @@ var require_cacheUtils = __commonJS({
return __awaiter2(this, void 0, void 0, function* () {
const versionOutput = yield getVersion("zstd", ["--quiet"]);
const version = semver9.clean(versionOutput);
core13.debug(`zstd version: ${version}`);
core14.debug(`zstd version: ${version}`);
if (versionOutput === "") {
return constants_1.CompressionMethod.Gzip;
} else {
@@ -91807,7 +91807,7 @@ var require_uploadUtils = __commonJS({
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.UploadProgress = void 0;
exports2.uploadCacheArchiveSDK = uploadCacheArchiveSDK;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var storage_blob_1 = require_commonjs15();
var errors_1 = require_errors3();
var UploadProgress = class {
@@ -91849,7 +91849,7 @@ var require_uploadUtils = __commonJS({
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
const elapsedTime = Date.now() - this.startTime;
const uploadSpeed = (transferredBytes / (1024 * 1024) / (elapsedTime / 1e3)).toFixed(1);
core13.info(`Sent ${transferredBytes} of ${this.contentLength} (${percentage}%), ${uploadSpeed} MBs/sec`);
core14.info(`Sent ${transferredBytes} of ${this.contentLength} (${percentage}%), ${uploadSpeed} MBs/sec`);
if (this.isDone()) {
this.displayedComplete = true;
}
@@ -91906,14 +91906,14 @@ var require_uploadUtils = __commonJS({
};
try {
uploadProgress.startDisplayTimer();
core13.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
core14.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
const response = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
if (response._response.status >= 400) {
throw new errors_1.InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${response._response.status}`);
}
return response;
} catch (error3) {
core13.warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${error3.message}`);
core14.warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${error3.message}`);
throw error3;
} finally {
uploadProgress.stopDisplayTimer();
@@ -91998,7 +91998,7 @@ var require_requestUtils = __commonJS({
exports2.retry = retry2;
exports2.retryTypedResponse = retryTypedResponse;
exports2.retryHttpClientResponse = retryHttpClientResponse;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var http_client_1 = require_lib();
var constants_1 = require_constants12();
function isSuccessStatusCode(statusCode) {
@@ -92056,9 +92056,9 @@ var require_requestUtils = __commonJS({
isRetryable = isRetryableStatusCode(statusCode);
errorMessage = `Cache service responded with ${statusCode}`;
}
core13.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
core14.debug(`${name} - Attempt ${attempt} of ${maxAttempts} failed with error: ${errorMessage}`);
if (!isRetryable) {
core13.debug(`${name} - Error is not retryable`);
core14.debug(`${name} - Error is not retryable`);
break;
}
yield sleep(delay2);
@@ -92317,7 +92317,7 @@ var require_downloadUtils = __commonJS({
exports2.downloadCacheHttpClient = downloadCacheHttpClient;
exports2.downloadCacheHttpClientConcurrent = downloadCacheHttpClientConcurrent;
exports2.downloadCacheStorageSDK = downloadCacheStorageSDK;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var http_client_1 = require_lib();
var storage_blob_1 = require_commonjs15();
var buffer = __importStar2(require("buffer"));
@@ -92355,7 +92355,7 @@ var require_downloadUtils = __commonJS({
this.segmentIndex = this.segmentIndex + 1;
this.segmentSize = segmentSize;
this.receivedBytes = 0;
core13.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`);
core14.debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`);
}
/**
* Sets the number of bytes received for the current segment.
@@ -92389,7 +92389,7 @@ var require_downloadUtils = __commonJS({
const percentage = (100 * (transferredBytes / this.contentLength)).toFixed(1);
const elapsedTime = Date.now() - this.startTime;
const downloadSpeed = (transferredBytes / (1024 * 1024) / (elapsedTime / 1e3)).toFixed(1);
core13.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`);
core14.info(`Received ${transferredBytes} of ${this.contentLength} (${percentage}%), ${downloadSpeed} MBs/sec`);
if (this.isDone()) {
this.displayedComplete = true;
}
@@ -92439,7 +92439,7 @@ var require_downloadUtils = __commonJS({
}));
downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
downloadResponse.message.destroy();
core13.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
core14.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
});
yield pipeResponseToStream(downloadResponse, writeStream);
const contentLengthHeader = downloadResponse.message.headers["content-length"];
@@ -92450,7 +92450,7 @@ var require_downloadUtils = __commonJS({
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
}
} else {
core13.debug("Unable to validate download, no Content-Length header");
core14.debug("Unable to validate download, no Content-Length header");
}
});
}
@@ -92568,7 +92568,7 @@ var require_downloadUtils = __commonJS({
const properties = yield client.getProperties();
const contentLength = (_a = properties.contentLength) !== null && _a !== void 0 ? _a : -1;
if (contentLength < 0) {
core13.debug("Unable to determine content length, downloading file with http-client...");
core14.debug("Unable to determine content length, downloading file with http-client...");
yield downloadCacheHttpClient(archiveLocation, archivePath);
} else {
const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH);
@@ -92658,7 +92658,7 @@ var require_options = __commonJS({
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.getUploadOptions = getUploadOptions;
exports2.getDownloadOptions = getDownloadOptions;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
function getUploadOptions(copy) {
const result = {
useAzureSdk: false,
@@ -92678,9 +92678,9 @@ var require_options = __commonJS({
}
result.uploadConcurrency = !isNaN(Number(process.env["CACHE_UPLOAD_CONCURRENCY"])) ? Math.min(32, Number(process.env["CACHE_UPLOAD_CONCURRENCY"])) : result.uploadConcurrency;
result.uploadChunkSize = !isNaN(Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"])) ? Math.min(128 * 1024 * 1024, Number(process.env["CACHE_UPLOAD_CHUNK_SIZE"]) * 1024 * 1024) : result.uploadChunkSize;
core13.debug(`Use Azure SDK: ${result.useAzureSdk}`);
core13.debug(`Upload concurrency: ${result.uploadConcurrency}`);
core13.debug(`Upload chunk size: ${result.uploadChunkSize}`);
core14.debug(`Use Azure SDK: ${result.useAzureSdk}`);
core14.debug(`Upload concurrency: ${result.uploadConcurrency}`);
core14.debug(`Upload chunk size: ${result.uploadChunkSize}`);
return result;
}
function getDownloadOptions(copy) {
@@ -92716,12 +92716,12 @@ var require_options = __commonJS({
if (segmentDownloadTimeoutMins && !isNaN(Number(segmentDownloadTimeoutMins)) && isFinite(Number(segmentDownloadTimeoutMins))) {
result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 60 * 1e3;
}
core13.debug(`Use Azure SDK: ${result.useAzureSdk}`);
core13.debug(`Download concurrency: ${result.downloadConcurrency}`);
core13.debug(`Request timeout (ms): ${result.timeoutInMs}`);
core13.debug(`Cache segment download timeout mins env var: ${process.env["SEGMENT_DOWNLOAD_TIMEOUT_MINS"]}`);
core13.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
core13.debug(`Lookup only: ${result.lookupOnly}`);
core14.debug(`Use Azure SDK: ${result.useAzureSdk}`);
core14.debug(`Download concurrency: ${result.downloadConcurrency}`);
core14.debug(`Request timeout (ms): ${result.timeoutInMs}`);
core14.debug(`Cache segment download timeout mins env var: ${process.env["SEGMENT_DOWNLOAD_TIMEOUT_MINS"]}`);
core14.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
core14.debug(`Lookup only: ${result.lookupOnly}`);
return result;
}
}
@@ -92915,7 +92915,7 @@ var require_cacheHttpClient = __commonJS({
exports2.downloadCache = downloadCache;
exports2.reserveCache = reserveCache;
exports2.saveCache = saveCache4;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var http_client_1 = require_lib();
var auth_1 = require_auth();
var fs13 = __importStar2(require("fs"));
@@ -92933,7 +92933,7 @@ var require_cacheHttpClient = __commonJS({
throw new Error("Cache Service Url not found, unable to restore cache.");
}
const url2 = `${baseUrl}_apis/artifactcache/${resource}`;
core13.debug(`Resource Url: ${url2}`);
core14.debug(`Resource Url: ${url2}`);
return url2;
}
function createAcceptHeader(type2, apiVersion) {
@@ -92961,7 +92961,7 @@ var require_cacheHttpClient = __commonJS({
return httpClient.getJson(getCacheApiUrl(resource));
}));
if (response.statusCode === 204) {
if (core13.isDebug()) {
if (core14.isDebug()) {
yield printCachesListForDiagnostics(keys[0], httpClient, version);
}
return null;
@@ -92974,9 +92974,9 @@ var require_cacheHttpClient = __commonJS({
if (!cacheDownloadUrl) {
throw new Error("Cache not found.");
}
core13.setSecret(cacheDownloadUrl);
core13.debug(`Cache Result:`);
core13.debug(JSON.stringify(cacheResult));
core14.setSecret(cacheDownloadUrl);
core14.debug(`Cache Result:`);
core14.debug(JSON.stringify(cacheResult));
return cacheResult;
});
}
@@ -92990,10 +92990,10 @@ var require_cacheHttpClient = __commonJS({
const cacheListResult = response.result;
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
if (totalCount && totalCount > 0) {
core13.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env["GITHUB_REF"]}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
core14.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env["GITHUB_REF"]}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key
Other caches with similar key:`);
for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) {
core13.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
core14.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
}
}
}
@@ -93036,7 +93036,7 @@ Other caches with similar key:`);
}
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
return __awaiter2(this, void 0, void 0, function* () {
core13.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
core14.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
const additionalHeaders = {
"Content-Type": "application/octet-stream",
"Content-Range": getContentRange(start, end)
@@ -93058,7 +93058,7 @@ Other caches with similar key:`);
const concurrency = utils.assertDefined("uploadConcurrency", uploadOptions.uploadConcurrency);
const maxChunkSize = utils.assertDefined("uploadChunkSize", uploadOptions.uploadChunkSize);
const parallelUploads = [...new Array(concurrency).keys()];
core13.debug("Awaiting all uploads");
core14.debug("Awaiting all uploads");
let offset = 0;
try {
yield Promise.all(parallelUploads.map(() => __awaiter2(this, void 0, void 0, function* () {
@@ -93101,16 +93101,16 @@ Other caches with similar key:`);
yield (0, uploadUtils_1.uploadCacheArchiveSDK)(signedUploadURL, archivePath, options);
} else {
const httpClient = createHttpClient();
core13.debug("Upload cache");
core14.debug("Upload cache");
yield uploadFile(httpClient, cacheId, archivePath, options);
core13.debug("Commiting cache");
core14.debug("Commiting cache");
const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
core13.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
core14.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) {
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
}
core13.info("Cache saved successfully");
core14.info("Cache saved successfully");
}
});
}
@@ -98593,7 +98593,7 @@ var require_cache5 = __commonJS({
exports2.isFeatureAvailable = isFeatureAvailable;
exports2.restoreCache = restoreCache4;
exports2.saveCache = saveCache4;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var path12 = __importStar2(require("path"));
var utils = __importStar2(require_cacheUtils());
var cacheHttpClient = __importStar2(require_cacheHttpClient());
@@ -98652,7 +98652,7 @@ var require_cache5 = __commonJS({
function restoreCache4(paths_1, primaryKey_1, restoreKeys_1, options_1) {
return __awaiter2(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
core13.debug(`Cache service version: ${cacheServiceVersion}`);
core14.debug(`Cache service version: ${cacheServiceVersion}`);
checkPaths(paths);
switch (cacheServiceVersion) {
case "v2":
@@ -98667,8 +98667,8 @@ var require_cache5 = __commonJS({
return __awaiter2(this, arguments, void 0, function* (paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
restoreKeys = restoreKeys || [];
const keys = [primaryKey, ...restoreKeys];
core13.debug("Resolved Keys:");
core13.debug(JSON.stringify(keys));
core14.debug("Resolved Keys:");
core14.debug(JSON.stringify(keys));
if (keys.length > 10) {
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
}
@@ -98686,19 +98686,19 @@ var require_cache5 = __commonJS({
return void 0;
}
if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
core13.info("Lookup only - skipping download");
core14.info("Lookup only - skipping download");
return cacheEntry.cacheKey;
}
archivePath = path12.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core13.debug(`Archive Path: ${archivePath}`);
core14.debug(`Archive Path: ${archivePath}`);
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
if (core13.isDebug()) {
if (core14.isDebug()) {
yield (0, tar_1.listTar)(archivePath, compressionMethod);
}
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core13.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
core14.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
yield (0, tar_1.extractTar)(archivePath, compressionMethod);
core13.info("Cache restored successfully");
core14.info("Cache restored successfully");
return cacheEntry.cacheKey;
} catch (error3) {
const typedError = error3;
@@ -98706,16 +98706,16 @@ var require_cache5 = __commonJS({
throw error3;
} else {
if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
core13.error(`Failed to restore: ${error3.message}`);
core14.error(`Failed to restore: ${error3.message}`);
} else {
core13.warning(`Failed to restore: ${error3.message}`);
core14.warning(`Failed to restore: ${error3.message}`);
}
}
} finally {
try {
yield utils.unlinkFile(archivePath);
} catch (error3) {
core13.debug(`Failed to delete archive: ${error3}`);
core14.debug(`Failed to delete archive: ${error3}`);
}
}
return void 0;
@@ -98726,8 +98726,8 @@ var require_cache5 = __commonJS({
options = Object.assign(Object.assign({}, options), { useAzureSdk: true });
restoreKeys = restoreKeys || [];
const keys = [primaryKey, ...restoreKeys];
core13.debug("Resolved Keys:");
core13.debug(JSON.stringify(keys));
core14.debug("Resolved Keys:");
core14.debug(JSON.stringify(keys));
if (keys.length > 10) {
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
}
@@ -98745,30 +98745,30 @@ var require_cache5 = __commonJS({
};
const response = yield twirpClient.GetCacheEntryDownloadURL(request2);
if (!response.ok) {
core13.debug(`Cache not found for version ${request2.version} of keys: ${keys.join(", ")}`);
core14.debug(`Cache not found for version ${request2.version} of keys: ${keys.join(", ")}`);
return void 0;
}
const isRestoreKeyMatch = request2.key !== response.matchedKey;
if (isRestoreKeyMatch) {
core13.info(`Cache hit for restore-key: ${response.matchedKey}`);
core14.info(`Cache hit for restore-key: ${response.matchedKey}`);
} else {
core13.info(`Cache hit for: ${response.matchedKey}`);
core14.info(`Cache hit for: ${response.matchedKey}`);
}
if (options === null || options === void 0 ? void 0 : options.lookupOnly) {
core13.info("Lookup only - skipping download");
core14.info("Lookup only - skipping download");
return response.matchedKey;
}
archivePath = path12.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core13.debug(`Archive path: ${archivePath}`);
core13.debug(`Starting download of archive to: ${archivePath}`);
core14.debug(`Archive path: ${archivePath}`);
core14.debug(`Starting download of archive to: ${archivePath}`);
yield cacheHttpClient.downloadCache(response.signedDownloadUrl, archivePath, options);
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core13.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
if (core13.isDebug()) {
core14.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
if (core14.isDebug()) {
yield (0, tar_1.listTar)(archivePath, compressionMethod);
}
yield (0, tar_1.extractTar)(archivePath, compressionMethod);
core13.info("Cache restored successfully");
core14.info("Cache restored successfully");
return response.matchedKey;
} catch (error3) {
const typedError = error3;
@@ -98776,9 +98776,9 @@ var require_cache5 = __commonJS({
throw error3;
} else {
if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
core13.error(`Failed to restore: ${error3.message}`);
core14.error(`Failed to restore: ${error3.message}`);
} else {
core13.warning(`Failed to restore: ${error3.message}`);
core14.warning(`Failed to restore: ${error3.message}`);
}
}
} finally {
@@ -98787,7 +98787,7 @@ var require_cache5 = __commonJS({
yield utils.unlinkFile(archivePath);
}
} catch (error3) {
core13.debug(`Failed to delete archive: ${error3}`);
core14.debug(`Failed to delete archive: ${error3}`);
}
}
return void 0;
@@ -98796,7 +98796,7 @@ var require_cache5 = __commonJS({
function saveCache4(paths_1, key_1, options_1) {
return __awaiter2(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
core13.debug(`Cache service version: ${cacheServiceVersion}`);
core14.debug(`Cache service version: ${cacheServiceVersion}`);
checkPaths(paths);
checkKey(key);
switch (cacheServiceVersion) {
@@ -98814,26 +98814,26 @@ var require_cache5 = __commonJS({
const compressionMethod = yield utils.getCompressionMethod();
let cacheId = -1;
const cachePaths = yield utils.resolvePaths(paths);
core13.debug("Cache Paths:");
core13.debug(`${JSON.stringify(cachePaths)}`);
core14.debug("Cache Paths:");
core14.debug(`${JSON.stringify(cachePaths)}`);
if (cachePaths.length === 0) {
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
}
const archiveFolder = yield utils.createTempDirectory();
const archivePath = path12.join(archiveFolder, utils.getCacheFileName(compressionMethod));
core13.debug(`Archive Path: ${archivePath}`);
core14.debug(`Archive Path: ${archivePath}`);
try {
yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod);
if (core13.isDebug()) {
if (core14.isDebug()) {
yield (0, tar_1.listTar)(archivePath, compressionMethod);
}
const fileSizeLimit = 10 * 1024 * 1024 * 1024;
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core13.debug(`File Size: ${archiveFileSize}`);
core14.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit && !(0, config_1.isGhes)()) {
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
}
core13.debug("Reserving Cache");
core14.debug("Reserving Cache");
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
compressionMethod,
enableCrossOsArchive,
@@ -98846,26 +98846,26 @@ var require_cache5 = __commonJS({
} else {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
}
core13.debug(`Saving Cache (ID: ${cacheId})`);
core14.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, "", options);
} catch (error3) {
const typedError = error3;
if (typedError.name === ValidationError.name) {
throw error3;
} else if (typedError.name === ReserveCacheError.name) {
core13.info(`Failed to save: ${typedError.message}`);
core14.info(`Failed to save: ${typedError.message}`);
} else {
if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
core13.error(`Failed to save: ${typedError.message}`);
core14.error(`Failed to save: ${typedError.message}`);
} else {
core13.warning(`Failed to save: ${typedError.message}`);
core14.warning(`Failed to save: ${typedError.message}`);
}
}
} finally {
try {
yield utils.unlinkFile(archivePath);
} catch (error3) {
core13.debug(`Failed to delete archive: ${error3}`);
core14.debug(`Failed to delete archive: ${error3}`);
}
}
return cacheId;
@@ -98878,23 +98878,23 @@ var require_cache5 = __commonJS({
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
let cacheId = -1;
const cachePaths = yield utils.resolvePaths(paths);
core13.debug("Cache Paths:");
core13.debug(`${JSON.stringify(cachePaths)}`);
core14.debug("Cache Paths:");
core14.debug(`${JSON.stringify(cachePaths)}`);
if (cachePaths.length === 0) {
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
}
const archiveFolder = yield utils.createTempDirectory();
const archivePath = path12.join(archiveFolder, utils.getCacheFileName(compressionMethod));
core13.debug(`Archive Path: ${archivePath}`);
core14.debug(`Archive Path: ${archivePath}`);
try {
yield (0, tar_1.createTar)(archiveFolder, cachePaths, compressionMethod);
if (core13.isDebug()) {
if (core14.isDebug()) {
yield (0, tar_1.listTar)(archivePath, compressionMethod);
}
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core13.debug(`File Size: ${archiveFileSize}`);
core14.debug(`File Size: ${archiveFileSize}`);
options.archiveSizeBytes = archiveFileSize;
core13.debug("Reserving Cache");
core14.debug("Reserving Cache");
const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive);
const request2 = {
key,
@@ -98905,16 +98905,16 @@ var require_cache5 = __commonJS({
const response = yield twirpClient.CreateCacheEntry(request2);
if (!response.ok) {
if (response.message) {
core13.warning(`Cache reservation failed: ${response.message}`);
core14.warning(`Cache reservation failed: ${response.message}`);
}
throw new Error(response.message || "Response was not ok");
}
signedUploadUrl = response.signedUploadUrl;
} catch (error3) {
core13.debug(`Failed to reserve cache: ${error3}`);
core14.debug(`Failed to reserve cache: ${error3}`);
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core13.debug(`Attempting to upload cache located at: ${archivePath}`);
core14.debug(`Attempting to upload cache located at: ${archivePath}`);
yield cacheHttpClient.saveCache(cacheId, archivePath, signedUploadUrl, options);
const finalizeRequest = {
key,
@@ -98922,7 +98922,7 @@ var require_cache5 = __commonJS({
sizeBytes: `${archiveFileSize}`
};
const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
core13.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`);
core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`);
if (!finalizeResponse.ok) {
if (finalizeResponse.message) {
throw new FinalizeCacheError(finalizeResponse.message);
@@ -98935,21 +98935,21 @@ var require_cache5 = __commonJS({
if (typedError.name === ValidationError.name) {
throw error3;
} else if (typedError.name === ReserveCacheError.name) {
core13.info(`Failed to save: ${typedError.message}`);
core14.info(`Failed to save: ${typedError.message}`);
} else if (typedError.name === FinalizeCacheError.name) {
core13.warning(typedError.message);
core14.warning(typedError.message);
} else {
if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) {
core13.error(`Failed to save: ${typedError.message}`);
core14.error(`Failed to save: ${typedError.message}`);
} else {
core13.warning(`Failed to save: ${typedError.message}`);
core14.warning(`Failed to save: ${typedError.message}`);
}
}
} finally {
try {
yield utils.unlinkFile(archivePath);
} catch (error3) {
core13.debug(`Failed to delete archive: ${error3}`);
core14.debug(`Failed to delete archive: ${error3}`);
}
}
return cacheId;
@@ -99176,7 +99176,7 @@ var require_retry_helper = __commonJS({
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.RetryHelper = void 0;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var RetryHelper = class {
constructor(maxAttempts, minSeconds, maxSeconds) {
if (maxAttempts < 1) {
@@ -99199,10 +99199,10 @@ var require_retry_helper = __commonJS({
if (isRetryable && !isRetryable(err)) {
throw err;
}
core13.info(err.message);
core14.info(err.message);
}
const seconds = this.getSleepAmount();
core13.info(`Waiting ${seconds} seconds before trying again`);
core14.info(`Waiting ${seconds} seconds before trying again`);
yield this.sleep(seconds);
attempt++;
}
@@ -99305,7 +99305,7 @@ var require_tool_cache = __commonJS({
exports2.findFromManifest = findFromManifest;
exports2.isExplicitVersion = isExplicitVersion;
exports2.evaluateVersions = evaluateVersions;
var core13 = __importStar2(require_core());
var core14 = __importStar2(require_core());
var io6 = __importStar2(require_io());
var crypto2 = __importStar2(require("crypto"));
var fs13 = __importStar2(require("fs"));
@@ -99334,8 +99334,8 @@ var require_tool_cache = __commonJS({
return __awaiter2(this, void 0, void 0, function* () {
dest = dest || path12.join(_getTempDirectory(), crypto2.randomUUID());
yield io6.mkdirP(path12.dirname(dest));
core13.debug(`Downloading ${url2}`);
core13.debug(`Destination ${dest}`);
core14.debug(`Downloading ${url2}`);
core14.debug(`Destination ${dest}`);
const maxAttempts = 3;
const minSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS", 10);
const maxSeconds = _getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS", 20);
@@ -99361,7 +99361,7 @@ var require_tool_cache = __commonJS({
allowRetries: false
});
if (auth2) {
core13.debug("set auth");
core14.debug("set auth");
if (headers === void 0) {
headers = {};
}
@@ -99370,7 +99370,7 @@ var require_tool_cache = __commonJS({
const response = yield http.get(url2, headers);
if (response.message.statusCode !== 200) {
const err = new HTTPError2(response.message.statusCode);
core13.debug(`Failed to download from "${url2}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
core14.debug(`Failed to download from "${url2}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
throw err;
}
const pipeline = util.promisify(stream2.pipeline);
@@ -99379,16 +99379,16 @@ var require_tool_cache = __commonJS({
let succeeded = false;
try {
yield pipeline(readStream, fs13.createWriteStream(dest));
core13.debug("download complete");
core14.debug("download complete");
succeeded = true;
return dest;
} finally {
if (!succeeded) {
core13.debug("download failed");
core14.debug("download failed");
try {
yield io6.rmRF(dest);
} catch (err) {
core13.debug(`Failed to delete '${dest}'. ${err.message}`);
core14.debug(`Failed to delete '${dest}'. ${err.message}`);
}
}
}
@@ -99403,7 +99403,7 @@ var require_tool_cache = __commonJS({
process.chdir(dest);
if (_7zPath) {
try {
const logLevel = core13.isDebug() ? "-bb1" : "-bb0";
const logLevel = core14.isDebug() ? "-bb1" : "-bb0";
const args = [
"x",
// eXtract files with full paths
@@ -99456,7 +99456,7 @@ var require_tool_cache = __commonJS({
throw new Error("parameter 'file' is required");
}
dest = yield _createExtractFolder(dest);
core13.debug("Checking tar --version");
core14.debug("Checking tar --version");
let versionOutput = "";
yield (0, exec_1.exec)("tar --version", [], {
ignoreReturnCode: true,
@@ -99466,7 +99466,7 @@ var require_tool_cache = __commonJS({
stderr: (data) => versionOutput += data.toString()
}
});
core13.debug(versionOutput.trim());
core14.debug(versionOutput.trim());
const isGnuTar = versionOutput.toUpperCase().includes("GNU TAR");
let args;
if (flags instanceof Array) {
@@ -99474,7 +99474,7 @@ var require_tool_cache = __commonJS({
} else {
args = [flags];
}
if (core13.isDebug() && !flags.includes("v")) {
if (core14.isDebug() && !flags.includes("v")) {
args.push("-v");
}
let destArg = dest;
@@ -99505,7 +99505,7 @@ var require_tool_cache = __commonJS({
args = [flags];
}
args.push("-x", "-C", dest, "-f", file);
if (core13.isDebug()) {
if (core14.isDebug()) {
args.push("-v");
}
const xarPath = yield io6.which("xar", true);
@@ -99548,7 +99548,7 @@ var require_tool_cache = __commonJS({
"-Command",
pwshCommand
];
core13.debug(`Using pwsh at path: ${pwshPath}`);
core14.debug(`Using pwsh at path: ${pwshPath}`);
yield (0, exec_1.exec)(`"${pwshPath}"`, args);
} else {
const powershellCommand = [
@@ -99568,7 +99568,7 @@ var require_tool_cache = __commonJS({
powershellCommand
];
const powershellPath = yield io6.which("powershell", true);
core13.debug(`Using powershell at path: ${powershellPath}`);
core14.debug(`Using powershell at path: ${powershellPath}`);
yield (0, exec_1.exec)(`"${powershellPath}"`, args);
}
});
@@ -99577,7 +99577,7 @@ var require_tool_cache = __commonJS({
return __awaiter2(this, void 0, void 0, function* () {
const unzipPath = yield io6.which("unzip", true);
const args = [file];
if (!core13.isDebug()) {
if (!core14.isDebug()) {
args.unshift("-q");
}
args.unshift("-o");
@@ -99588,8 +99588,8 @@ var require_tool_cache = __commonJS({
return __awaiter2(this, void 0, void 0, function* () {
version = semver9.clean(version) || version;
arch2 = arch2 || os2.arch();
core13.debug(`Caching tool ${tool} ${version} ${arch2}`);
core13.debug(`source dir: ${sourceDir}`);
core14.debug(`Caching tool ${tool} ${version} ${arch2}`);
core14.debug(`source dir: ${sourceDir}`);
if (!fs13.statSync(sourceDir).isDirectory()) {
throw new Error("sourceDir is not a directory");
}
@@ -99606,14 +99606,14 @@ var require_tool_cache = __commonJS({
return __awaiter2(this, void 0, void 0, function* () {
version = semver9.clean(version) || version;
arch2 = arch2 || os2.arch();
core13.debug(`Caching tool ${tool} ${version} ${arch2}`);
core13.debug(`source file: ${sourceFile}`);
core14.debug(`Caching tool ${tool} ${version} ${arch2}`);
core14.debug(`source file: ${sourceFile}`);
if (!fs13.statSync(sourceFile).isFile()) {
throw new Error("sourceFile is not a file");
}
const destFolder = yield _createToolPath(tool, version, arch2);
const destPath = path12.join(destFolder, targetFile);
core13.debug(`destination file ${destPath}`);
core14.debug(`destination file ${destPath}`);
yield io6.cp(sourceFile, destPath);
_completeToolPath(tool, version, arch2);
return destFolder;
@@ -99636,12 +99636,12 @@ var require_tool_cache = __commonJS({
if (versionSpec) {
versionSpec = semver9.clean(versionSpec) || "";
const cachePath = path12.join(_getCacheDirectory(), toolName, versionSpec, arch2);
core13.debug(`checking cache: ${cachePath}`);
core14.debug(`checking cache: ${cachePath}`);
if (fs13.existsSync(cachePath) && fs13.existsSync(`${cachePath}.complete`)) {
core13.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`);
core14.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch2}`);
toolPath = cachePath;
} else {
core13.debug("not found");
core14.debug("not found");
}
}
return toolPath;
@@ -99670,7 +99670,7 @@ var require_tool_cache = __commonJS({
const http = new httpm.HttpClient("tool-cache");
const headers = {};
if (auth2) {
core13.debug("set auth");
core14.debug("set auth");
headers.authorization = auth2;
}
const response = yield http.getJson(treeUrl, headers);
@@ -99691,7 +99691,7 @@ var require_tool_cache = __commonJS({
try {
releases = JSON.parse(versionsRaw);
} catch (_a) {
core13.debug("Invalid json");
core14.debug("Invalid json");
}
}
return releases;
@@ -99715,7 +99715,7 @@ var require_tool_cache = __commonJS({
function _createToolPath(tool, version, arch2) {
return __awaiter2(this, void 0, void 0, function* () {
const folderPath = path12.join(_getCacheDirectory(), tool, semver9.clean(version) || version, arch2 || "");
core13.debug(`destination ${folderPath}`);
core14.debug(`destination ${folderPath}`);
const markerPath = `${folderPath}.complete`;
yield io6.rmRF(folderPath);
yield io6.rmRF(markerPath);
@@ -99727,18 +99727,18 @@ var require_tool_cache = __commonJS({
const folderPath = path12.join(_getCacheDirectory(), tool, semver9.clean(version) || version, arch2 || "");
const markerPath = `${folderPath}.complete`;
fs13.writeFileSync(markerPath, "");
core13.debug("finished caching tool");
core14.debug("finished caching tool");
}
function isExplicitVersion(versionSpec) {
const c = semver9.clean(versionSpec) || "";
core13.debug(`isExplicit: ${c}`);
core14.debug(`isExplicit: ${c}`);
const valid3 = semver9.valid(c) != null;
core13.debug(`explicit? ${valid3}`);
core14.debug(`explicit? ${valid3}`);
return valid3;
}
function evaluateVersions(versions, versionSpec) {
let version = "";
core13.debug(`evaluating ${versions.length} versions`);
core14.debug(`evaluating ${versions.length} versions`);
versions = versions.sort((a, b) => {
if (semver9.gt(a, b)) {
return 1;
@@ -99754,9 +99754,9 @@ var require_tool_cache = __commonJS({
}
}
if (version) {
core13.debug(`matched: ${version}`);
core14.debug(`matched: ${version}`);
} else {
core13.debug("match not found");
core14.debug("match not found");
}
return version;
}
@@ -103253,7 +103253,7 @@ var fs12 = __toESM(require("fs"));
var path11 = __toESM(require("path"));
var url = __toESM(require("url"));
var import_zlib = __toESM(require("zlib"));
var core12 = __toESM(require_core());
var core13 = __toESM(require_core());
var jsonschema2 = __toESM(require_lib2());
// src/actions-util.ts
@@ -106564,7 +106564,7 @@ function wrapApiConfigurationError(e) {
// src/codeql.ts
var fs9 = __toESM(require("fs"));
var path9 = __toESM(require("path"));
var core10 = __toESM(require_core());
var core11 = __toESM(require_core());
var toolrunner3 = __toESM(require_toolrunner());
// src/cli-errors.ts
@@ -106812,6 +106812,7 @@ function wrapCliConfigurationError(cliError) {
// src/config-utils.ts
var fs5 = __toESM(require("fs"));
var path6 = __toESM(require("path"));
var core9 = __toESM(require_core());
// src/caching-utils.ts
var core6 = __toESM(require_core());
@@ -107730,7 +107731,7 @@ var fs7 = __toESM(require("fs"));
var os = __toESM(require("os"));
var path7 = __toESM(require("path"));
var import_perf_hooks = require("perf_hooks");
var core9 = __toESM(require_core());
var core10 = __toESM(require_core());
var import_http_client = __toESM(require_lib());
var toolcache2 = __toESM(require_tool_cache());
var import_follow_redirects = __toESM(require_follow_redirects());
@@ -107784,10 +107785,10 @@ async function downloadAndExtract(codeqlURL, compressionMethod, dest, authorizat
};
}
} catch (e) {
core9.warning(
core10.warning(
`Failed to download and extract CodeQL bundle using streaming with error: ${getErrorMessage(e)}`
);
core9.warning(`Falling back to downloading the bundle before extracting.`);
core10.warning(`Falling back to downloading the bundle before extracting.`);
await cleanUpPath(dest, "CodeQL bundle", logger);
}
const toolsDownloadStart = import_perf_hooks.performance.now();
@@ -108972,12 +108973,12 @@ ${output}`
);
} else if (checkVersion && process.env["CODEQL_ACTION_SUPPRESS_DEPRECATED_SOON_WARNING" /* SUPPRESS_DEPRECATED_SOON_WARNING */] !== "true" && !await codeQlVersionAtLeast(codeql, CODEQL_NEXT_MINIMUM_VERSION)) {
const result = await codeql.getVersion();
core10.warning(
core11.warning(
`CodeQL CLI version ${result.version} was discontinued on ${GHES_MOST_RECENT_DEPRECATION_DATE} alongside GitHub Enterprise Server ${GHES_VERSION_MOST_RECENTLY_DEPRECATED} and will not be supported by the next minor release of the CodeQL Action. Please update to CodeQL CLI version ${CODEQL_NEXT_MINIMUM_VERSION} or later. For instance, if you have specified a custom version of the CLI using the 'tools' input to the 'init' Action, you can remove this input to use the default version.
Alternatively, if you want to continue using CodeQL CLI version ${result.version}, you can replace 'github/codeql-action/*@v${getActionVersion().split(".")[0]}' by 'github/codeql-action/*@v${getActionVersion()}' in your code scanning workflow to continue using this version of the CodeQL Action.`
);
core10.exportVariable("CODEQL_ACTION_SUPPRESS_DEPRECATED_SOON_WARNING" /* SUPPRESS_DEPRECATED_SOON_WARNING */, "true");
core11.exportVariable("CODEQL_ACTION_SUPPRESS_DEPRECATED_SOON_WARNING" /* SUPPRESS_DEPRECATED_SOON_WARNING */, "true");
}
return codeql;
}
@@ -110205,7 +110206,7 @@ async function addFingerprints(sarifLog, sourceRoot, logger) {
}
// src/init.ts
var core11 = __toESM(require_core());
var core12 = __toESM(require_core());
var toolrunner4 = __toESM(require_toolrunner());
var github2 = __toESM(require_github());
var io5 = __toESM(require_io());
@@ -110349,7 +110350,7 @@ async function combineSarifFilesUsingCLI(sarifFiles, gitHubVersion, features, lo
logger.warning(
`Uploading multiple SARIF runs with the same category is deprecated ${deprecationWarningMessage}. Please update your workflow to upload a single run per category. ${deprecationMoreInformationMessage}`
);
core12.exportVariable("CODEQL_MERGE_SARIF_DEPRECATION_WARNING", "true");
core13.exportVariable("CODEQL_MERGE_SARIF_DEPRECATION_WARNING", "true");
}
return combineSarifFiles(sarifFiles, logger);
}
@@ -110448,13 +110449,13 @@ async function uploadPayload(payload, repositoryNwo, logger, analysis) {
if (httpError !== void 0) {
switch (httpError.status) {
case 403:
core12.warning(httpError.message || GENERIC_403_MSG);
core13.warning(httpError.message || GENERIC_403_MSG);
break;
case 404:
core12.warning(httpError.message || GENERIC_404_MSG);
core13.warning(httpError.message || GENERIC_404_MSG);
break;
default:
core12.warning(httpError.message);
core13.warning(httpError.message);
break;
}
}
@@ -110888,7 +110889,7 @@ function validateUniqueCategory(sarifLog, sentinelPrefix) {
`Aborting upload: only one run of the codeql/analyze or codeql/upload-sarif actions is allowed per job per tool/category. The easiest fix is to specify a unique value for the \`category\` input. If .runs[].automationDetails.id is specified in the sarif file, that will take precedence over your configured \`category\`. Category: (${id ? id : "none"}) Tool: (${tool ? tool : "none"})`
);
}
core12.exportVariable(sentinelEnvVar, sentinelEnvVar);
core13.exportVariable(sentinelEnvVar, sentinelEnvVar);
}
}
function sanitize(str2) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -64,7 +64,6 @@ function createTestInitConfigInputs(
configInput: undefined,
buildModeInput: undefined,
ramInput: undefined,
trapCachingEnabled: false,
dependencyCachingEnabled: CachingKind.None,
debugMode: false,
debugArtifactName: "",

View File

@@ -2,10 +2,12 @@ import * as fs from "fs";
import * as path from "path";
import { performance } from "perf_hooks";
import * as core from "@actions/core";
import * as yaml from "js-yaml";
import {
getActionVersion,
getOptionalInput,
isAnalyzingPullRequest,
isDynamicWorkflow,
} from "./actions-util";
@@ -72,6 +74,7 @@ import {
Result,
Success,
Failure,
isHostedRunner,
} from "./util";
/**
@@ -452,7 +455,6 @@ export interface InitConfigInputs {
configInput: string | undefined;
buildModeInput: string | undefined;
ramInput: string | undefined;
trapCachingEnabled: boolean;
dependencyCachingEnabled: string | undefined;
debugMode: boolean;
debugArtifactName: string;
@@ -482,7 +484,6 @@ export async function initActionState(
packsInput,
buildModeInput,
dbLocation,
trapCachingEnabled,
dependencyCachingEnabled,
debugMode,
debugArtifactName,
@@ -540,13 +541,6 @@ export async function initActionState(
};
}
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
trapCachingEnabled,
codeql,
languages,
logger,
);
// Compute the full Code Scanning configuration that combines the configuration from the
// configuration file / `config` input with other inputs, such as `queries`.
const computedConfig = generateCodeScanningConfig(
@@ -569,8 +563,8 @@ export async function initActionState(
debugMode,
debugArtifactName,
debugDatabaseName,
trapCaches,
trapCacheDownloadTime,
trapCaches: {},
trapCacheDownloadTime: 0,
dependencyCachingEnabled: getCachingKind(dependencyCachingEnabled),
dependencyCachingRestoredKeys: [],
extraQueryExclusions: [],
@@ -582,7 +576,6 @@ export async function initActionState(
}
async function downloadCacheWithTime(
trapCachingEnabled: boolean,
codeQL: CodeQL,
languages: Language[],
logger: Logger,
@@ -590,13 +583,9 @@ async function downloadCacheWithTime(
trapCaches: { [language: string]: string };
trapCacheDownloadTime: number;
}> {
let trapCaches: { [language: string]: string } = {};
let trapCacheDownloadTime = 0;
if (trapCachingEnabled) {
const start = performance.now();
trapCaches = await downloadTrapCaches(codeQL, languages, logger);
trapCacheDownloadTime = performance.now() - start;
}
const start = performance.now();
const trapCaches = await downloadTrapCaches(codeQL, languages, logger);
const trapCacheDownloadTime = performance.now() - start;
return { trapCaches, trapCacheDownloadTime };
}
@@ -1009,6 +998,42 @@ async function validateOverlayDatabaseMode(
});
}
async function isTrapCachingEnabled(
_features: FeatureEnablement,
_overlayDatabaseMode: OverlayDatabaseMode,
): Promise<boolean> {
// If the workflow specified something always respect that
const trapCaching = getOptionalInput("trap-caching");
if (trapCaching !== undefined) return trapCaching === "true";
// On self-hosted runners which may have slow network access, disable TRAP caching by default
if (!isHostedRunner()) return false;
// Otherwise, enable TRAP caching
return true;
}
async function setCppTrapCachingEnvironmentVariables(
config: Config,
codeql: CodeQL,
logger: Logger,
): Promise<void> {
if (config.languages.includes(KnownLanguage.cpp)) {
const envVar = "CODEQL_EXTRACTOR_CPP_TRAP_CACHING";
if (process.env[envVar]) {
logger.info(
`Environment variable ${envVar} already set. Not en/disabling CodeQL C++ TRAP caching support`,
);
} else if (await codeQlVersionAtLeast(codeql, "2.17.5")) {
logger.info("Enabling CodeQL C++ TRAP caching support");
core.exportVariable(envVar, "true");
} else {
logger.info("Disabling CodeQL C++ TRAP caching support");
core.exportVariable(envVar, "false");
}
}
}
function dbLocationOrDefault(
dbLocation: string | undefined,
tempDir: string,
@@ -1199,6 +1224,19 @@ export async function initConfig(
exclude: { tags: "exclude-from-incremental" },
});
}
if (await isTrapCachingEnabled(features, config.overlayDatabaseMode)) {
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
inputs.codeql,
config.languages,
logger,
);
config.trapCaches = trapCaches;
config.trapCacheDownloadTime = trapCacheDownloadTime;
await setCppTrapCachingEnvironmentVariables(config, inputs.codeql, logger);
}
return config;
}

View File

@@ -88,7 +88,6 @@ import {
getRequiredEnvParam,
getThreadsFlagValue,
initializeEnvironment,
isHostedRunner,
ConfigurationError,
wrapError,
checkActionVersion,
@@ -362,7 +361,6 @@ async function run(startedAt: Date) {
configFile,
dbLocation: getOptionalInput("db-location"),
configInput: getOptionalInput("config"),
trapCachingEnabled: getTrapCachingEnabled(),
dependencyCachingEnabled: getDependencyCachingEnabled(),
// Debug mode is enabled if:
// - The `init` Action is passed `debug: true`.
@@ -613,24 +611,6 @@ async function run(startedAt: Date) {
core.exportVariable(kotlinLimitVar, "2.1.20");
}
if (config.languages.includes(KnownLanguage.cpp)) {
const envVar = "CODEQL_EXTRACTOR_CPP_TRAP_CACHING";
if (process.env[envVar]) {
logger.info(
`Environment variable ${envVar} already set. Not en/disabling CodeQL C++ TRAP caching support`,
);
} else if (
getTrapCachingEnabled() &&
(await codeQlVersionAtLeast(codeql, "2.17.5"))
) {
logger.info("Enabling CodeQL C++ TRAP caching support");
core.exportVariable(envVar, "true");
} else {
logger.info("Disabling CodeQL C++ TRAP caching support");
core.exportVariable(envVar, "false");
}
}
// Restore dependency cache(s), if they exist.
if (shouldRestoreCache(config.dependencyCachingEnabled)) {
const dependencyCachingResult = await downloadDependencyCaches(
@@ -864,18 +844,6 @@ async function loadRepositoryProperties(
}
}
function getTrapCachingEnabled(): boolean {
// If the workflow specified something always respect that
const trapCaching = getOptionalInput("trap-caching");
if (trapCaching !== undefined) return trapCaching === "true";
// On self-hosted runners which may have slow network access, disable TRAP caching by default
if (!isHostedRunner()) return false;
// On hosted runners, enable TRAP caching by default
return true;
}
async function recordZstdAvailability(
config: configUtils.Config,
zstdAvailability: ZstdAvailability,