Return keys of restored caches from downloadDependencyCaches

This commit is contained in:
Michael B. Gale
2025-11-14 11:36:59 +00:00
parent 85f1517bb4
commit 11889c27fd
4 changed files with 95 additions and 30 deletions
+17 -7
View File
@@ -87317,6 +87317,7 @@ async function checkHashPatterns(codeql, features, language, cacheConfig, checkT
}
async function downloadDependencyCaches(codeql, features, languages, logger) {
const status = [];
const restoredKeys = [];
for (const language of languages) {
const cacheConfig = defaultCacheConfigs[language];
if (cacheConfig === void 0) {
@@ -87355,14 +87356,22 @@ async function downloadDependencyCaches(codeql, features, languages, logger) {
const download_duration_ms = Math.round(performance.now() - start);
if (hitKey !== void 0) {
logger.info(`Cache hit on key ${hitKey} for ${language}.`);
const hit_kind = hitKey === primaryKey ? "exact" /* Exact */ : "partial" /* Partial */;
status.push({ language, hit_kind, download_duration_ms });
let hit_kind = "partial" /* Partial */;
if (hitKey === primaryKey) {
hit_kind = "exact" /* Exact */;
}
status.push({
language,
hit_kind,
download_duration_ms
});
restoredKeys.push(hitKey);
} else {
status.push({ language, hit_kind: "miss" /* Miss */ });
logger.info(`No suitable cache found for ${language}.`);
}
}
return status;
return { statusReport: status, restoredKeys };
}
async function cacheKey2(codeql, features, language, patterns) {
const hash = await glob.hashFiles(patterns.join("\n"));
@@ -89994,7 +90003,7 @@ async function run() {
return;
}
let overlayBaseDatabaseStats;
let dependencyCachingResults;
let dependencyCachingStatus;
try {
if (config.overlayDatabaseMode === "overlay" /* Overlay */ && config.useOverlayDatabaseCaching) {
overlayBaseDatabaseStats = await downloadOverlayBaseDatabaseFromCache(
@@ -90135,12 +90144,13 @@ exec ${goBinaryPath} "$@"`
}
}
if (shouldRestoreCache(config.dependencyCachingEnabled)) {
dependencyCachingResults = await downloadDependencyCaches(
const dependencyCachingResult = await downloadDependencyCaches(
codeql,
features,
config.languages,
logger
);
dependencyCachingStatus = dependencyCachingResult.statusReport;
}
if (await codeQlVersionAtLeast(codeql, "2.17.1")) {
} else {
@@ -90241,7 +90251,7 @@ exec ${goBinaryPath} "$@"`
toolsSource,
toolsVersion,
overlayBaseDatabaseStats,
dependencyCachingResults,
dependencyCachingStatus,
logger,
error4
);
@@ -90259,7 +90269,7 @@ exec ${goBinaryPath} "$@"`
toolsSource,
toolsVersion,
overlayBaseDatabaseStats,
dependencyCachingResults,
dependencyCachingStatus,
logger
);
}