From 11480e326c449cb21c7445fc7ed2b51bba59709b Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 23 Sep 2025 11:25:22 +0100 Subject: [PATCH 1/8] Add telemetry for restoring dependency caches --- lib/init-action.js | 29 +++++++++++++++++++------- src/dependency-caching.ts | 43 ++++++++++++++++++++++++++++++++++----- src/init-action.ts | 12 +++++++++-- src/status-report.test.ts | 1 + src/status-report.ts | 7 +++++++ 5 files changed, 78 insertions(+), 14 deletions(-) diff --git a/lib/init-action.js b/lib/init-action.js index b19951d8e9..91c00e45f8 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88137,7 +88137,7 @@ async function makeGlobber(patterns) { return glob.create(patterns.join("\n")); } async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { - const restoredCaches = []; + const status = {}; for (const language of languages) { const cacheConfig = getDefaultCacheConfig()[language]; if (cacheConfig === void 0) { @@ -88148,6 +88148,7 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { } const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { + status[language] = { hit: "no-hash" /* NoHash */ }; logger.info( `Skipping download of dependency cache for ${language} as we cannot calculate a hash for the cache key.` ); @@ -88162,19 +88163,26 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { ", " )}` ); + const start = performance.now(); const hitKey = await actionsCache3.restoreCache( cacheConfig.paths, primaryKey, restoreKeys ); + const download_duration_ms = Math.round(performance.now() - start); + const download_size_bytes = Math.round( + await getTotalCacheSize(cacheConfig.paths, logger) + ); if (hitKey !== void 0) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); - restoredCaches.push(language); + const hit = hitKey === primaryKey ? "exact" /* Exact */ : "partial" /* Partial */; + status[language] = { hit, download_duration_ms, download_size_bytes }; } else { + status[language] = { hit: "miss" /* Miss */ }; logger.info(`No suitable cache found for ${language}.`); } } - return restoredCaches; + return status; } async function cacheKey2(language, cacheConfig, minimizeJavaJars = false) { const hash = await glob.hashFiles(cacheConfig.hash.join("\n")); @@ -90278,7 +90286,7 @@ async function sendStatusReport(statusReport) { ); } } -async function createInitWithConfigStatusReport(config, initStatusReport, configFile, totalCacheSize, overlayBaseDatabaseStats) { +async function createInitWithConfigStatusReport(config, initStatusReport, configFile, totalCacheSize, overlayBaseDatabaseStats, dependencyCachingResults) { const languages = config.languages.join(","); const paths = (config.originalUserInput.paths || []).join(","); const pathsIgnore = (config.originalUserInput["paths-ignore"] || []).join( @@ -90315,6 +90323,9 @@ async function createInitWithConfigStatusReport(config, initStatusReport, config trap_cache_download_duration_ms: Math.round(config.trapCacheDownloadTime), overlay_base_database_download_size_bytes: overlayBaseDatabaseStats?.databaseSizeBytes, overlay_base_database_download_duration_ms: overlayBaseDatabaseStats?.databaseDownloadDurationMs, + dependency_caching_restore_results: JSON.stringify( + dependencyCachingResults ?? {} + ), query_filters: JSON.stringify( config.originalUserInput["query-filters"] ?? [] ), @@ -90497,7 +90508,7 @@ async function getWorkflowAbsolutePath(logger) { } // src/init-action.ts -async function sendCompletedStatusReport(startedAt, config, configFile, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, overlayBaseDatabaseStats, logger, error2) { +async function sendCompletedStatusReport(startedAt, config, configFile, toolsDownloadStatusReport, toolsFeatureFlagsValid, toolsSource, toolsVersion, overlayBaseDatabaseStats, dependencyCachingResults, logger, error2) { const statusReportBase = await createStatusReportBase( "init" /* Init */, getActionsStatus(error2), @@ -90534,7 +90545,8 @@ async function sendCompletedStatusReport(startedAt, config, configFile, toolsDow Math.round( await getTotalCacheSize(Object.values(config.trapCaches), logger) ), - overlayBaseDatabaseStats + overlayBaseDatabaseStats, + dependencyCachingResults ); await sendStatusReport({ ...initWithConfigStatusReport, @@ -90698,6 +90710,7 @@ async function run() { return; } let overlayBaseDatabaseStats; + let dependencyCachingResults; try { if (config.overlayDatabaseMode === "overlay" /* Overlay */ && config.useOverlayDatabaseCaching) { overlayBaseDatabaseStats = await downloadOverlayBaseDatabaseFromCache( @@ -90842,7 +90855,7 @@ exec ${goBinaryPath} "$@"` codeql ); if (shouldRestoreCache(config.dependencyCachingEnabled)) { - await downloadDependencyCaches( + dependencyCachingResults = await downloadDependencyCaches( config.languages, logger, minimizeJavaJars @@ -90947,6 +90960,7 @@ exec ${goBinaryPath} "$@"` toolsSource, toolsVersion, overlayBaseDatabaseStats, + dependencyCachingResults, logger, error2 ); @@ -90964,6 +90978,7 @@ exec ${goBinaryPath} "$@"` toolsSource, toolsVersion, overlayBaseDatabaseStats, + dependencyCachingResults, logger ); } diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index 6289ca2f68..773e4de9e6 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -84,20 +84,44 @@ async function makeGlobber(patterns: string[]): Promise { return glob.create(patterns.join("\n")); } +/** Enumerates possible outcomes for cache hits. */ +export enum CacheHitResult { + /** We were unable to calculate a hash for the key. */ + NoHash = "no-hash", + /** No cache was found. */ + Miss = "miss", + /** The primary cache key matched. */ + Exact = "exact", + /** A restore key matched. */ + Partial = "partial", +} + +/** Represents results of trying to restore a dependency cache for a language. */ +export interface DependencyCacheRestoreStatus { + hit: CacheHitResult; + download_size_bytes?: number; + download_duration_ms?: number; +} + +/** A partial mapping from languages to the results of restoring dependency caches for them. */ +export type DependencyCacheRestoreStatusReport = Partial< + Record +>; + /** * Attempts to restore dependency caches for the languages being analyzed. * * @param languages The languages being analyzed. * @param logger A logger to record some informational messages to. * @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size. - * @returns A list of languages for which dependency caches were restored. + * @returns A partial mapping of languages to results of restoring dependency caches for them. */ export async function downloadDependencyCaches( languages: Language[], logger: Logger, minimizeJavaJars: boolean, -): Promise { - const restoredCaches: Language[] = []; +): Promise { + const status: DependencyCacheRestoreStatusReport = {}; for (const language of languages) { const cacheConfig = getDefaultCacheConfig()[language]; @@ -114,6 +138,7 @@ export async function downloadDependencyCaches( const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { + status[language] = { hit: CacheHitResult.NoHash }; logger.info( `Skipping download of dependency cache for ${language} as we cannot calculate a hash for the cache key.`, ); @@ -131,21 +156,29 @@ export async function downloadDependencyCaches( )}`, ); + const start = performance.now(); const hitKey = await actionsCache.restoreCache( cacheConfig.paths, primaryKey, restoreKeys, ); + const download_duration_ms = Math.round(performance.now() - start); + const download_size_bytes = Math.round( + await getTotalCacheSize(cacheConfig.paths, logger), + ); if (hitKey !== undefined) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); - restoredCaches.push(language); + const hit = + hitKey === primaryKey ? CacheHitResult.Exact : CacheHitResult.Partial; + status[language] = { hit, download_duration_ms, download_size_bytes }; } else { + status[language] = { hit: CacheHitResult.Miss }; logger.info(`No suitable cache found for ${language}.`); } } - return restoredCaches; + return status; } /** diff --git a/src/init-action.ts b/src/init-action.ts index 2b4dba3fcf..114ad6cab1 100644 --- a/src/init-action.ts +++ b/src/init-action.ts @@ -23,7 +23,10 @@ import { } from "./caching-utils"; import { CodeQL } from "./codeql"; import * as configUtils from "./config-utils"; -import { downloadDependencyCaches } from "./dependency-caching"; +import { + DependencyCacheRestoreStatusReport, + downloadDependencyCaches, +} from "./dependency-caching"; import { addDiagnostic, flushDiagnostics, @@ -102,6 +105,7 @@ async function sendCompletedStatusReport( toolsSource: ToolsSource, toolsVersion: string, overlayBaseDatabaseStats: OverlayBaseDatabaseDownloadStats | undefined, + dependencyCachingResults: DependencyCacheRestoreStatusReport | undefined, logger: Logger, error?: Error, ) { @@ -151,6 +155,7 @@ async function sendCompletedStatusReport( await getTotalCacheSize(Object.values(config.trapCaches), logger), ), overlayBaseDatabaseStats, + dependencyCachingResults, ); await sendStatusReport({ ...initWithConfigStatusReport, @@ -351,6 +356,7 @@ async function run() { } let overlayBaseDatabaseStats: OverlayBaseDatabaseDownloadStats | undefined; + let dependencyCachingResults: DependencyCacheRestoreStatusReport | undefined; try { if ( config.overlayDatabaseMode === OverlayDatabaseMode.Overlay && @@ -562,7 +568,7 @@ async function run() { codeql, ); if (shouldRestoreCache(config.dependencyCachingEnabled)) { - await downloadDependencyCaches( + dependencyCachingResults = await downloadDependencyCaches( config.languages, logger, minimizeJavaJars, @@ -714,6 +720,7 @@ async function run() { toolsSource, toolsVersion, overlayBaseDatabaseStats, + dependencyCachingResults, logger, error, ); @@ -736,6 +743,7 @@ async function run() { toolsSource, toolsVersion, overlayBaseDatabaseStats, + dependencyCachingResults, logger, ); } diff --git a/src/status-report.test.ts b/src/status-report.test.ts index 0d3292637c..b535ef2126 100644 --- a/src/status-report.test.ts +++ b/src/status-report.test.ts @@ -286,6 +286,7 @@ const testCreateInitWithConfigStatusReport = test.macro({ undefined, 1024, undefined, + undefined, ); if (t.truthy(initWithConfigStatusReport)) { diff --git a/src/status-report.ts b/src/status-report.ts index 75f4002214..41f63a20a9 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -13,6 +13,7 @@ import { } from "./actions-util"; import { getAnalysisKey, getApiClient } from "./api-client"; import { parseRegistriesWithoutCredentials, type Config } from "./config-utils"; +import { DependencyCacheRestoreStatusReport } from "./dependency-caching"; import { DocUrl } from "./doc-url"; import { EnvVar } from "./environment"; import { getRef } from "./git-utils"; @@ -497,6 +498,8 @@ export interface InitWithConfigStatusReport extends InitStatusReport { overlay_base_database_download_size_bytes?: number; /** Time taken to download the overlay-base database, in milliseconds. */ overlay_base_database_download_duration_ms?: number; + /** Stringified JSON object representing information about the results of restoring dependency caches. */ + dependency_caching_restore_results: string; /** Stringified JSON array of registry configuration objects, from the 'registries' config field or workflow input. **/ registries: string; @@ -522,6 +525,7 @@ export async function createInitWithConfigStatusReport( configFile: string | undefined, totalCacheSize: number, overlayBaseDatabaseStats: OverlayBaseDatabaseDownloadStats | undefined, + dependencyCachingResults: DependencyCacheRestoreStatusReport | undefined, ): Promise { const languages = config.languages.join(","); const paths = (config.originalUserInput.paths || []).join(","); @@ -570,6 +574,9 @@ export async function createInitWithConfigStatusReport( overlayBaseDatabaseStats?.databaseSizeBytes, overlay_base_database_download_duration_ms: overlayBaseDatabaseStats?.databaseDownloadDurationMs, + dependency_caching_restore_results: JSON.stringify( + dependencyCachingResults ?? {}, + ), query_filters: JSON.stringify( config.originalUserInput["query-filters"] ?? [], ), From 249a3cbb5c7c03cd2c5dd6872f30f562c2710753 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 23 Sep 2025 11:48:49 +0100 Subject: [PATCH 2/8] Add telemetry for storing dependency caches --- lib/analyze-action.js | 30 ++++++++++++++++++++++++--- src/analyze-action.ts | 27 +++++++++++++++++++++--- src/dependency-caching.ts | 43 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 93 insertions(+), 7 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index d4ea9eada0..0b5e2b2522 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -93292,6 +93292,7 @@ async function makeGlobber(patterns) { return glob.create(patterns.join("\n")); } async function uploadDependencyCaches(config, logger, minimizeJavaJars) { + const status = {}; for (const language of config.languages) { const cacheConfig = getDefaultCacheConfig()[language]; if (cacheConfig === void 0) { @@ -93302,6 +93303,7 @@ async function uploadDependencyCaches(config, logger, minimizeJavaJars) { } const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { + status[language] = { result: "no-hash" /* NoHash */ }; logger.info( `Skipping upload of dependency cache for ${language} as we cannot calculate a hash for the cache key.` ); @@ -93309,6 +93311,7 @@ async function uploadDependencyCaches(config, logger, minimizeJavaJars) { } const size = await getTotalCacheSize(cacheConfig.paths, logger, true); if (size === 0) { + status[language] = { result: "empty" /* Empty */ }; logger.info( `Skipping upload of dependency cache for ${language} since it is empty.` ); @@ -93319,18 +93322,27 @@ async function uploadDependencyCaches(config, logger, minimizeJavaJars) { `Uploading cache of size ${size} for ${language} with key ${key}...` ); try { + const start = performance.now(); await actionsCache3.saveCache(cacheConfig.paths, key); + const upload_duration_ms = Math.round(performance.now() - start); + status[language] = { + result: "stored" /* Stored */, + upload_size_bytes: Math.round(size), + upload_duration_ms + }; } catch (error2) { if (error2 instanceof actionsCache3.ReserveCacheError) { logger.info( `Not uploading cache for ${language}, because ${key} is already in use.` ); logger.debug(error2.message); + status[language] = { result: "duplicate" /* Duplicate */ }; } else { throw error2; } } } + return status; } async function cacheKey2(language, cacheConfig, minimizeJavaJars = false) { const hash2 = await glob.hashFiles(cacheConfig.hash.join("\n")); @@ -95895,7 +95907,7 @@ function filterAlertsByDiffRange(logger, sarif) { } // src/analyze-action.ts -async function sendStatusReport2(startedAt, config, stats, error2, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanup, logger) { +async function sendStatusReport2(startedAt, config, stats, error2, trapCacheUploadTime, dbCreationTimings, didUploadTrapCaches, trapCacheCleanup, dependencyCacheResults, logger) { const status = getActionsStatus(error2, stats?.analyze_failure_language); const statusReportBase = await createStatusReportBase( "finish" /* Analyze */, @@ -95912,7 +95924,10 @@ async function sendStatusReport2(startedAt, config, stats, error2, trapCacheUplo ...statusReportBase, ...stats || {}, ...dbCreationTimings || {}, - ...trapCacheCleanup || {} + ...trapCacheCleanup || {}, + dependency_caching_upload_results: JSON.stringify( + dependencyCacheResults ?? {} + ) }; if (config && didUploadTrapCaches) { const trapCacheUploadStatusReport = { @@ -95993,6 +96008,7 @@ async function run() { let trapCacheUploadTime = void 0; let dbCreationTimings = void 0; let didUploadTrapCaches = false; + let dependencyCacheResults; initializeEnvironment(getActionVersion()); persistInputs(); const logger = getActionsLogger(); @@ -96131,7 +96147,11 @@ async function run() { "java_minimize_dependency_jars" /* JavaMinimizeDependencyJars */, codeql ); - await uploadDependencyCaches(config, logger, minimizeJavaJars); + dependencyCacheResults = await uploadDependencyCaches( + config, + logger, + minimizeJavaJars + ); } if (isInTestMode()) { logger.debug("In test mode. Waiting for processing is disabled."); @@ -96162,6 +96182,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger ); return; @@ -96179,6 +96200,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger ); } else if (runStats) { @@ -96191,6 +96213,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger ); } else { @@ -96203,6 +96226,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger ); } diff --git a/src/analyze-action.ts b/src/analyze-action.ts index 31251be488..6422981ceb 100644 --- a/src/analyze-action.ts +++ b/src/analyze-action.ts @@ -26,7 +26,10 @@ import { isCodeScanningEnabled, } from "./config-utils"; import { uploadDatabases } from "./database-upload"; -import { uploadDependencyCaches } from "./dependency-caching"; +import { + DependencyCacheUploadStatusReport, + uploadDependencyCaches, +} from "./dependency-caching"; import { getDiffInformedAnalysisBranches } from "./diff-informed-analysis-utils"; import { EnvVar } from "./environment"; import { Feature, Features } from "./feature-flags"; @@ -55,10 +58,15 @@ interface AnalysisStatusReport extends uploadLib.UploadStatusReport, QueriesStatusReport {} +interface DependencyCachingUploadStatusReport { + dependency_caching_upload_results?: string; +} + interface FinishStatusReport extends StatusReportBase, DatabaseCreationTimings, - AnalysisStatusReport {} + AnalysisStatusReport, + DependencyCachingUploadStatusReport {} interface FinishWithTrapUploadStatusReport extends FinishStatusReport { /** Size of TRAP caches that we uploaded, in bytes. */ @@ -76,6 +84,7 @@ async function sendStatusReport( dbCreationTimings: DatabaseCreationTimings | undefined, didUploadTrapCaches: boolean, trapCacheCleanup: TrapCacheCleanupStatusReport | undefined, + dependencyCacheResults: DependencyCacheUploadStatusReport | undefined, logger: Logger, ) { const status = getActionsStatus(error, stats?.analyze_failure_language); @@ -95,6 +104,9 @@ async function sendStatusReport( ...(stats || {}), ...(dbCreationTimings || {}), ...(trapCacheCleanup || {}), + dependency_caching_upload_results: JSON.stringify( + dependencyCacheResults ?? {}, + ), }; if (config && didUploadTrapCaches) { const trapCacheUploadStatusReport: FinishWithTrapUploadStatusReport = { @@ -209,6 +221,7 @@ async function run() { let trapCacheUploadTime: number | undefined = undefined; let dbCreationTimings: DatabaseCreationTimings | undefined = undefined; let didUploadTrapCaches = false; + let dependencyCacheResults: DependencyCacheUploadStatusReport | undefined; util.initializeEnvironment(actionsUtil.getActionVersion()); // Make inputs accessible in the `post` step, details at @@ -388,7 +401,11 @@ async function run() { Feature.JavaMinimizeDependencyJars, codeql, ); - await uploadDependencyCaches(config, logger, minimizeJavaJars); + dependencyCacheResults = await uploadDependencyCaches( + config, + logger, + minimizeJavaJars, + ); } // We don't upload results in test mode, so don't wait for processing @@ -431,6 +448,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger, ); return; @@ -449,6 +467,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger, ); } else if (runStats) { @@ -461,6 +480,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger, ); } else { @@ -473,6 +493,7 @@ async function run() { dbCreationTimings, didUploadTrapCaches, trapCacheCleanupTelemetry, + dependencyCacheResults, logger, ); } diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index 773e4de9e6..f5a2ada8f3 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -181,18 +181,45 @@ export async function downloadDependencyCaches( return status; } +/** Enumerates possible outcomes for cache hits. */ +export enum CacheStoreResult { + /** We were unable to calculate a hash for the key. */ + NoHash = "no-hash", + /** There is nothing to store in the cache. */ + Empty = "empty", + /** There already exists a cache with the key we are trying to store. */ + Duplicate = "duplicate", + /** The cache was stored successfully. */ + Stored = "stored", +} + +/** Represents results of trying to upload a dependency cache for a language. */ +export interface DependencyCacheUploadStatus { + result: CacheStoreResult; + upload_size_bytes?: number; + upload_duration_ms?: number; +} + +/** A partial mapping from languages to the results of uploading dependency caches for them. */ +export type DependencyCacheUploadStatusReport = Partial< + Record +>; + /** * Attempts to store caches for the languages that were analyzed. * * @param config The configuration for this workflow. * @param logger A logger to record some informational messages to. * @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size. + * + * @returns A partial mapping of languages to results of uploading dependency caches for them. */ export async function uploadDependencyCaches( config: Config, logger: Logger, minimizeJavaJars: boolean, -): Promise { +): Promise { + const status: DependencyCacheUploadStatusReport = {}; for (const language of config.languages) { const cacheConfig = getDefaultCacheConfig()[language]; @@ -208,6 +235,7 @@ export async function uploadDependencyCaches( const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { + status[language] = { result: CacheStoreResult.NoHash }; logger.info( `Skipping upload of dependency cache for ${language} as we cannot calculate a hash for the cache key.`, ); @@ -228,6 +256,7 @@ export async function uploadDependencyCaches( // Skip uploading an empty cache. if (size === 0) { + status[language] = { result: CacheStoreResult.Empty }; logger.info( `Skipping upload of dependency cache for ${language} since it is empty.`, ); @@ -241,7 +270,15 @@ export async function uploadDependencyCaches( ); try { + const start = performance.now(); await actionsCache.saveCache(cacheConfig.paths, key); + const upload_duration_ms = Math.round(performance.now() - start); + + status[language] = { + result: CacheStoreResult.Stored, + upload_size_bytes: Math.round(size), + upload_duration_ms, + }; } catch (error) { // `ReserveCacheError` indicates that the cache key is already in use, which means that a // cache with that key already exists or is in the process of being uploaded by another @@ -251,12 +288,16 @@ export async function uploadDependencyCaches( `Not uploading cache for ${language}, because ${key} is already in use.`, ); logger.debug(error.message); + + status[language] = { result: CacheStoreResult.Duplicate }; } else { // Propagate other errors upwards. throw error; } } } + + return status; } /** From 3d7d7c978ea51fe2ff068f73ebc7352be74cbcf7 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 23 Sep 2025 11:56:50 +0100 Subject: [PATCH 3/8] Fix comment --- src/dependency-caching.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index f5a2ada8f3..819651670c 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -181,7 +181,7 @@ export async function downloadDependencyCaches( return status; } -/** Enumerates possible outcomes for cache hits. */ +/** Enumerates possible outcomes for storing caches. */ export enum CacheStoreResult { /** We were unable to calculate a hash for the key. */ NoHash = "no-hash", From 7dfbfdcb01431ab18c19420c696972639214a21f Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Tue, 23 Sep 2025 12:28:42 +0100 Subject: [PATCH 4/8] Report overall cache usage for CodeQL dependency caches --- lib/init-action-post.js | 41 ++++++++++++++++++++++++++++++---- src/api-client.ts | 2 +- src/dependency-caching.ts | 34 +++++++++++++++++++++++++++- src/init-action-post-helper.ts | 4 ++++ src/init-action-post.ts | 22 +++++++++++++++++- 5 files changed, 96 insertions(+), 7 deletions(-) diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 7b85c8e0a1..9ea1459a9e 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -128487,6 +128487,18 @@ function computeAutomationID(analysis_key, environment) { } return automationID; } +async function listActionsCaches(key, ref) { + const repositoryNwo = getRepositoryNwo(); + return await getApiClient().paginate( + "GET /repos/{owner}/{repo}/actions/caches", + { + owner: repositoryNwo.owner, + repo: repositoryNwo.repo, + key, + ref + } + ); +} function wrapApiConfigurationError(e) { if (isHTTPError(e)) { if (e.message.includes("API rate limit exceeded for installation") || e.message.includes("commit not found") || e.message.includes("Resource not accessible by integration") || /ref .* not found in this repository/.test(e.message)) { @@ -128500,6 +128512,9 @@ function wrapApiConfigurationError(e) { return e; } +// src/caching-utils.ts +var core6 = __toESM(require_core()); + // src/codeql.ts var fs13 = __toESM(require("fs")); var path13 = __toESM(require("path")); @@ -128771,9 +128786,6 @@ var CodeQuality = { sentinelPrefix: "CODEQL_UPLOAD_QUALITY_SARIF_" }; -// src/caching-utils.ts -var core6 = __toESM(require_core()); - // src/config/db-config.ts var semver2 = __toESM(require_semver2()); var PACK_IDENTIFIER_PATTERN = (function() { @@ -131123,6 +131135,22 @@ var core11 = __toESM(require_core()); // src/dependency-caching.ts var actionsCache3 = __toESM(require_cache3()); var glob = __toESM(require_glob3()); +var CODEQL_DEPENDENCY_CACHE_PREFIX = "codeql-dependencies"; +async function getDependencyCacheUsage(logger) { + try { + const caches = await listActionsCaches(CODEQL_DEPENDENCY_CACHE_PREFIX); + const totalSize = caches.reduce( + (acc, cache) => acc + (cache.size_in_bytes ?? 0), + 0 + ); + return { count: caches.length, size_bytes: totalSize }; + } catch (err) { + logger.warning( + `Unable to retrieve information about dependency cache usage: ${getErrorMessage(err)}` + ); + } + return void 0; +} // src/analyze.ts function dbIsFinalized(config, language, logger) { @@ -133672,6 +133700,7 @@ async function runWrapper() { const startedAt = /* @__PURE__ */ new Date(); let config; let uploadFailedSarifResult; + let dependencyCachingUsage; try { restoreInputs(); const gitHubVersion = await getGitHubVersion(); @@ -133699,6 +133728,9 @@ async function runWrapper() { features, logger ); + if (await isAnalyzingDefaultBranch() && config.dependencyCachingEnabled !== "none" /* None */) { + dependencyCachingUsage = await getDependencyCacheUsage(logger); + } } } catch (unwrappedError) { const error2 = wrapError(unwrappedError); @@ -133732,7 +133764,8 @@ async function runWrapper() { const statusReport = { ...statusReportBase, ...uploadFailedSarifResult, - job_status: getFinalJobStatus() + job_status: getFinalJobStatus(), + dependency_caching_usage: JSON.stringify(dependencyCachingUsage ?? {}) }; logger.info("Sending status report for init-post step."); await sendStatusReport(statusReport); diff --git a/src/api-client.ts b/src/api-client.ts index 8e4a30c571..555a46bb43 100644 --- a/src/api-client.ts +++ b/src/api-client.ts @@ -214,7 +214,7 @@ export interface ActionsCacheItem { /** List all Actions cache entries matching the provided key and ref. */ export async function listActionsCaches( key: string, - ref: string, + ref?: string, ): Promise { const repositoryNwo = getRepositoryNwo(); diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index 819651670c..aca7b9ae7d 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -5,12 +5,13 @@ import * as actionsCache from "@actions/cache"; import * as glob from "@actions/glob"; import { getTemporaryDirectory } from "./actions-util"; +import { listActionsCaches } from "./api-client"; import { getTotalCacheSize } from "./caching-utils"; import { Config } from "./config-utils"; import { EnvVar } from "./environment"; import { KnownLanguage, Language } from "./languages"; import { Logger } from "./logging"; -import { getRequiredEnvParam } from "./util"; +import { getErrorMessage, getRequiredEnvParam } from "./util"; /** * Caching configuration for a particular language. @@ -344,3 +345,34 @@ async function cachePrefix( return `${prefix}-${CODEQL_DEPENDENCY_CACHE_VERSION}-${runnerOs}-${language}-`; } + +/** Represents information about our overall cache usage for CodeQL dependency caches. */ +export interface DependencyCachingUsageReport { + count: number; + size_bytes: number; +} + +/** + * Tries to determine the overall cache usage for CodeQL dependencies caches. + * + * @param logger The logger to log errors to. + * @returns Returns the overall cache usage for CodeQL dependencies caches, or `undefined` if we couldn't determine it. + */ +export async function getDependencyCacheUsage( + logger: Logger, +): Promise { + try { + const caches = await listActionsCaches(CODEQL_DEPENDENCY_CACHE_PREFIX); + const totalSize = caches.reduce( + (acc, cache) => acc + (cache.size_in_bytes ?? 0), + 0, + ); + return { count: caches.length, size_bytes: totalSize }; + } catch (err) { + logger.warning( + `Unable to retrieve information about dependency cache usage: ${getErrorMessage(err)}`, + ); + } + + return undefined; +} diff --git a/src/init-action-post-helper.ts b/src/init-action-post-helper.ts index 0d21bd3b66..3b1d6aea72 100644 --- a/src/init-action-post-helper.ts +++ b/src/init-action-post-helper.ts @@ -45,6 +45,10 @@ export interface JobStatusReport { job_status: JobStatus; } +export interface DependencyCachingUsageReport { + dependency_caching_usage?: string; +} + function createFailedUploadFailedSarifResult( error: unknown, ): UploadFailedSarifResult { diff --git a/src/init-action-post.ts b/src/init-action-post.ts index b7c0e92a4d..74759bb3c7 100644 --- a/src/init-action-post.ts +++ b/src/init-action-post.ts @@ -12,10 +12,16 @@ import { printDebugLogs, } from "./actions-util"; import { getGitHubVersion } from "./api-client"; +import { CachingKind } from "./caching-utils"; import { getCodeQL } from "./codeql"; import { Config, getConfig } from "./config-utils"; import * as debugArtifacts from "./debug-artifacts"; +import { + DependencyCachingUsageReport, + getDependencyCacheUsage, +} from "./dependency-caching"; import { Features } from "./feature-flags"; +import * as gitUtils from "./git-utils"; import * as initActionPostHelper from "./init-action-post-helper"; import { getActionsLogger } from "./logging"; import { getRepositoryNwo } from "./repository"; @@ -32,7 +38,8 @@ import { checkDiskUsage, checkGitHubVersionInRange, wrapError } from "./util"; interface InitPostStatusReport extends StatusReportBase, initActionPostHelper.UploadFailedSarifResult, - initActionPostHelper.JobStatusReport {} + initActionPostHelper.JobStatusReport, + initActionPostHelper.DependencyCachingUsageReport {} async function runWrapper() { const logger = getActionsLogger(); @@ -41,6 +48,7 @@ async function runWrapper() { let uploadFailedSarifResult: | initActionPostHelper.UploadFailedSarifResult | undefined; + let dependencyCachingUsage: DependencyCachingUsageReport | undefined; try { // Restore inputs from `init` Action. restoreInputs(); @@ -73,6 +81,17 @@ async function runWrapper() { features, logger, ); + + // If we are analysing the default branch and some kind of caching is enabled, + // then try to determine our overall cache usage for dependency caches. We only + // do this under these circumstances to avoid slowing down analyses for PRs + // and where caching may not be enabled. + if ( + (await gitUtils.isAnalyzingDefaultBranch()) && + config.dependencyCachingEnabled !== CachingKind.None + ) { + dependencyCachingUsage = await getDependencyCacheUsage(logger); + } } } catch (unwrappedError) { const error = wrapError(unwrappedError); @@ -109,6 +128,7 @@ async function runWrapper() { ...statusReportBase, ...uploadFailedSarifResult, job_status: initActionPostHelper.getFinalJobStatus(), + dependency_caching_usage: JSON.stringify(dependencyCachingUsage ?? {}), }; logger.info("Sending status report for init-post step."); await sendStatusReport(statusReport); From 2ff902e1f1619b6569d7d000985300490f3f3962 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Thu, 25 Sep 2025 20:53:23 +0100 Subject: [PATCH 5/8] Rename `CacheHitResult` and `hit` --- lib/analyze-action-post.js | 56 +++++++++++++++++++++---- lib/analyze-action.js | 56 +++++++++++++++++++++---- lib/autobuild-action.js | 56 +++++++++++++++++++++---- lib/init-action-post.js | 56 +++++++++++++++++++++---- lib/init-action.js | 68 +++++++++++++++++++++++++------ lib/resolve-environment-action.js | 56 +++++++++++++++++++++---- lib/start-proxy-action-post.js | 56 +++++++++++++++++++++---- lib/upload-lib.js | 56 +++++++++++++++++++++---- lib/upload-sarif-action-post.js | 56 +++++++++++++++++++++---- lib/upload-sarif-action.js | 56 +++++++++++++++++++++---- src/dependency-caching.ts | 18 ++++---- 11 files changed, 489 insertions(+), 101 deletions(-) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index e15cba6d6d..bf2c317803 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -67282,7 +67282,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -72091,11 +72091,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72114,6 +72121,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72130,6 +72141,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -72235,11 +72248,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72258,6 +72278,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72274,6 +72298,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -73037,7 +73063,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); var path6 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -73045,7 +73071,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants7(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -73063,6 +73088,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError2; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -73334,9 +73367,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core14.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core14.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -73348,7 +73378,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core14.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -73365,6 +73398,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -73374,6 +73410,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError2.name) { core14.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core14.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core14.error(`Failed to save: ${typedError.message}`); diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 0b5e2b2522..bf59496d50 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -73131,7 +73131,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -77940,11 +77940,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -77963,6 +77970,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -77979,6 +77990,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78084,11 +78097,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -78107,6 +78127,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -78123,6 +78147,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78886,7 +78912,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core15 = __importStar4(require_core()); var path20 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -78894,7 +78920,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants10(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -78912,6 +78937,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError2; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -79183,9 +79216,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core15.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core15.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -79197,7 +79227,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core15.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -79214,6 +79247,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core15.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -79223,6 +79259,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError2.name) { core15.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core15.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core15.error(`Failed to save: ${typedError.message}`); diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 39ffcb2caf..e5b063a765 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -67282,7 +67282,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -72091,11 +72091,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72114,6 +72121,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72130,6 +72141,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -72235,11 +72248,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72258,6 +72278,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72274,6 +72298,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -73037,7 +73063,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); var path7 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -73045,7 +73071,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants7(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -73063,6 +73088,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -73334,9 +73367,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core14.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core14.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -73348,7 +73378,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core14.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -73365,6 +73398,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -73374,6 +73410,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError.name) { core14.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core14.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core14.error(`Failed to save: ${typedError.message}`); diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 9ea1459a9e..ae5bee7487 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -73131,7 +73131,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -77940,11 +77940,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -77963,6 +77970,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -77979,6 +77990,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78084,11 +78097,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -78107,6 +78127,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -78123,6 +78147,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78886,7 +78912,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core18 = __importStar4(require_core()); var path19 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -78894,7 +78920,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants10(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -78912,6 +78937,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError2; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -79183,9 +79216,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core18.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core18.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -79197,7 +79227,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core18.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -79214,6 +79247,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core18.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -79223,6 +79259,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError2.name) { core18.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core18.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core18.error(`Failed to save: ${typedError.message}`); diff --git a/lib/init-action.js b/lib/init-action.js index 91c00e45f8..f410060e9e 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -73131,7 +73131,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -77940,11 +77940,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -77963,6 +77970,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -77979,6 +77990,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78084,11 +78097,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -78107,6 +78127,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -78123,6 +78147,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78886,7 +78912,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); var path20 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -78894,7 +78920,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants10(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -78912,6 +78937,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError2; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -79183,9 +79216,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core14.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core14.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -79197,7 +79227,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core14.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -79214,6 +79247,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -79223,6 +79259,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError2.name) { core14.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core14.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core14.error(`Failed to save: ${typedError.message}`); @@ -88148,7 +88186,7 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { } const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { - status[language] = { hit: "no-hash" /* NoHash */ }; + status[language] = { hit_kind: "no-hash" /* NoHash */ }; logger.info( `Skipping download of dependency cache for ${language} as we cannot calculate a hash for the cache key.` ); @@ -88175,10 +88213,14 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { ); if (hitKey !== void 0) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); - const hit = hitKey === primaryKey ? "exact" /* Exact */ : "partial" /* Partial */; - status[language] = { hit, download_duration_ms, download_size_bytes }; + const hit_kind = hitKey === primaryKey ? "exact" /* Exact */ : "partial" /* Partial */; + status[language] = { + hit_kind, + download_duration_ms, + download_size_bytes + }; } else { - status[language] = { hit: "miss" /* Miss */ }; + status[language] = { hit_kind: "miss" /* Miss */ }; logger.info(`No suitable cache found for ${language}.`); } } diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 3325f696ef..6e50f77665 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -67282,7 +67282,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -72091,11 +72091,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72114,6 +72121,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72130,6 +72141,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -72235,11 +72248,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72258,6 +72278,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72274,6 +72298,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -73037,7 +73063,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core13 = __importStar4(require_core()); var path5 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -73045,7 +73071,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants7(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -73063,6 +73088,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -73334,9 +73367,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core13.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core13.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -73348,7 +73378,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core13.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -73365,6 +73398,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core13.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -73374,6 +73410,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError.name) { core13.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core13.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}`); diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index ae0917c6cf..742f47096f 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -67282,7 +67282,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -72091,11 +72091,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72114,6 +72121,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72130,6 +72141,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -72235,11 +72248,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -72258,6 +72278,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -72274,6 +72298,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -73037,7 +73063,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); var path2 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -73045,7 +73071,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants7(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -73063,6 +73088,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError2; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -73334,9 +73367,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core14.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core14.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -73348,7 +73378,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core14.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -73365,6 +73398,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -73374,6 +73410,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError2.name) { core14.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core14.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core14.error(`Failed to save: ${typedError.message}`); diff --git a/lib/upload-lib.js b/lib/upload-lib.js index c5d0f57c0d..2042d456a5 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -74428,7 +74428,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -79237,11 +79237,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -79260,6 +79267,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -79276,6 +79287,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -79381,11 +79394,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -79404,6 +79424,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -79420,6 +79444,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -80183,7 +80209,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core12 = __importStar4(require_core()); var path15 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -80191,7 +80217,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants10(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -80209,6 +80234,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -80480,9 +80513,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core12.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core12.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -80494,7 +80524,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core12.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -80511,6 +80544,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core12.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -80520,6 +80556,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError.name) { core12.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core12.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core12.error(`Failed to save: ${typedError.message}`); diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index b5bbe531fa..28186e5600 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -109984,7 +109984,7 @@ var require_package3 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -110567,11 +110567,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -110590,6 +110597,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -110606,6 +110617,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -110711,11 +110724,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -110734,6 +110754,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -110750,6 +110774,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -111513,7 +111539,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); var path2 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -111521,7 +111547,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config2(); var tar_1 = require_tar2(); - var constants_1 = require_constants10(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -111539,6 +111564,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError2; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -111810,9 +111843,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core14.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core14.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -111824,7 +111854,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core14.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -111841,6 +111874,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -111850,6 +111886,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError2.name) { core14.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core14.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core14.error(`Failed to save: ${typedError.message}`); diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 95d5b9c02e..e35709fd0b 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -73131,7 +73131,7 @@ var require_package2 = __commonJS({ "node_modules/@actions/cache/package.json"(exports2, module2) { module2.exports = { name: "@actions/cache", - version: "4.0.5", + version: "4.1.0", preview: true, description: "Actions cache lib", keywords: [ @@ -77940,11 +77940,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 9 /*ScalarType.STRING*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, signedUploadUrl: "" }; + const message = { ok: false, signedUploadUrl: "", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -77963,6 +77970,10 @@ var require_cache2 = __commonJS({ 2: message.signedUploadUrl = reader.string(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -77979,6 +77990,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.signedUploadUrl !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.signedUploadUrl); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78084,11 +78097,18 @@ var require_cache2 = __commonJS({ kind: "scalar", T: 3 /*ScalarType.INT64*/ + }, + { + no: 3, + name: "message", + kind: "scalar", + T: 9 + /*ScalarType.STRING*/ } ]); } create(value) { - const message = { ok: false, entryId: "0" }; + const message = { ok: false, entryId: "0", message: "" }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== void 0) (0, runtime_3.reflectionMergePartial)(this, message, value); @@ -78107,6 +78127,10 @@ var require_cache2 = __commonJS({ 2: message.entryId = reader.int64().toString(); break; + case /* string message */ + 3: + message.message = reader.string(); + break; default: let u = options.readUnknownField; if (u === "throw") @@ -78123,6 +78147,8 @@ var require_cache2 = __commonJS({ writer.tag(1, runtime_1.WireType.Varint).bool(message.ok); if (message.entryId !== "0") writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId); + if (message.message !== "") + writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.message); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); @@ -78886,7 +78912,7 @@ var require_cache3 = __commonJS({ }); }; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.ReserveCacheError = exports2.ValidationError = void 0; + exports2.saveCache = exports2.restoreCache = exports2.isFeatureAvailable = exports2.FinalizeCacheError = exports2.ReserveCacheError = exports2.ValidationError = void 0; var core14 = __importStar4(require_core()); var path16 = __importStar4(require("path")); var utils = __importStar4(require_cacheUtils()); @@ -78894,7 +78920,6 @@ var require_cache3 = __commonJS({ var cacheTwirpClient = __importStar4(require_cacheTwirpClient()); var config_1 = require_config(); var tar_1 = require_tar(); - var constants_1 = require_constants10(); var http_client_1 = require_lib(); var ValidationError = class _ValidationError extends Error { constructor(message) { @@ -78912,6 +78937,14 @@ var require_cache3 = __commonJS({ } }; exports2.ReserveCacheError = ReserveCacheError; + var FinalizeCacheError = class _FinalizeCacheError extends Error { + constructor(message) { + super(message); + this.name = "FinalizeCacheError"; + Object.setPrototypeOf(this, _FinalizeCacheError.prototype); + } + }; + exports2.FinalizeCacheError = FinalizeCacheError; function checkPaths(paths) { if (!paths || paths.length === 0) { throw new ValidationError(`Path Validation Error: At least one directory or file path is required`); @@ -79183,9 +79216,6 @@ var require_cache3 = __commonJS({ } const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath); core14.debug(`File Size: ${archiveFileSize}`); - if (archiveFileSize > constants_1.CacheFileSizeLimit && !(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.`); - } options.archiveSizeBytes = archiveFileSize; core14.debug("Reserving Cache"); const version = utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive); @@ -79197,7 +79227,10 @@ var require_cache3 = __commonJS({ try { const response = yield twirpClient.CreateCacheEntry(request); if (!response.ok) { - throw new Error("Response was not ok"); + if (response.message) { + core14.warning(`Cache reservation failed: ${response.message}`); + } + throw new Error(response.message || "Response was not ok"); } signedUploadUrl = response.signedUploadUrl; } catch (error2) { @@ -79214,6 +79247,9 @@ var require_cache3 = __commonJS({ const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); core14.debug(`FinalizeCacheEntryUploadResponse: ${finalizeResponse.ok}`); if (!finalizeResponse.ok) { + if (finalizeResponse.message) { + throw new FinalizeCacheError(finalizeResponse.message); + } throw new Error(`Unable to finalize cache with key ${key}, another job may be finalizing this cache.`); } cacheId = parseInt(finalizeResponse.entryId); @@ -79223,6 +79259,8 @@ var require_cache3 = __commonJS({ throw error2; } else if (typedError.name === ReserveCacheError.name) { core14.info(`Failed to save: ${typedError.message}`); + } else if (typedError.name === FinalizeCacheError.name) { + core14.warning(typedError.message); } else { if (typedError instanceof http_client_1.HttpClientError && typeof typedError.statusCode === "number" && typedError.statusCode >= 500) { core14.error(`Failed to save: ${typedError.message}`); diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index aca7b9ae7d..28b4a156a6 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -86,7 +86,7 @@ async function makeGlobber(patterns: string[]): Promise { } /** Enumerates possible outcomes for cache hits. */ -export enum CacheHitResult { +export enum CacheHitKind { /** We were unable to calculate a hash for the key. */ NoHash = "no-hash", /** No cache was found. */ @@ -99,7 +99,7 @@ export enum CacheHitResult { /** Represents results of trying to restore a dependency cache for a language. */ export interface DependencyCacheRestoreStatus { - hit: CacheHitResult; + hit_kind: CacheHitKind; download_size_bytes?: number; download_duration_ms?: number; } @@ -139,7 +139,7 @@ export async function downloadDependencyCaches( const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { - status[language] = { hit: CacheHitResult.NoHash }; + status[language] = { hit_kind: CacheHitKind.NoHash }; logger.info( `Skipping download of dependency cache for ${language} as we cannot calculate a hash for the cache key.`, ); @@ -170,11 +170,15 @@ export async function downloadDependencyCaches( if (hitKey !== undefined) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); - const hit = - hitKey === primaryKey ? CacheHitResult.Exact : CacheHitResult.Partial; - status[language] = { hit, download_duration_ms, download_size_bytes }; + const hit_kind = + hitKey === primaryKey ? CacheHitKind.Exact : CacheHitKind.Partial; + status[language] = { + hit_kind, + download_duration_ms, + download_size_bytes, + }; } else { - status[language] = { hit: CacheHitResult.Miss }; + status[language] = { hit_kind: CacheHitKind.Miss }; logger.info(`No suitable cache found for ${language}.`); } } From ed577678982fff91b9ccd2f8bfd78a20744c6a49 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Thu, 25 Sep 2025 21:02:43 +0100 Subject: [PATCH 6/8] Don't measure size of downloaded cache --- lib/init-action.js | 6 +----- src/dependency-caching.ts | 5 ----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/init-action.js b/lib/init-action.js index f410060e9e..994a68e6db 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88208,16 +88208,12 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { restoreKeys ); const download_duration_ms = Math.round(performance.now() - start); - const download_size_bytes = Math.round( - await getTotalCacheSize(cacheConfig.paths, logger) - ); if (hitKey !== void 0) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); const hit_kind = hitKey === primaryKey ? "exact" /* Exact */ : "partial" /* Partial */; status[language] = { hit_kind, - download_duration_ms, - download_size_bytes + download_duration_ms }; } else { status[language] = { hit_kind: "miss" /* Miss */ }; diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index 28b4a156a6..dedd1075c4 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -100,7 +100,6 @@ export enum CacheHitKind { /** Represents results of trying to restore a dependency cache for a language. */ export interface DependencyCacheRestoreStatus { hit_kind: CacheHitKind; - download_size_bytes?: number; download_duration_ms?: number; } @@ -164,9 +163,6 @@ export async function downloadDependencyCaches( restoreKeys, ); const download_duration_ms = Math.round(performance.now() - start); - const download_size_bytes = Math.round( - await getTotalCacheSize(cacheConfig.paths, logger), - ); if (hitKey !== undefined) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); @@ -175,7 +171,6 @@ export async function downloadDependencyCaches( status[language] = { hit_kind, download_duration_ms, - download_size_bytes, }; } else { status[language] = { hit_kind: CacheHitKind.Miss }; From 31bfb99f0d18cdaf5bda03699c3acaa8401c5a26 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Fri, 26 Sep 2025 00:26:09 +0100 Subject: [PATCH 7/8] Do not use stringified objects for dependency caching telemetry --- lib/analyze-action.js | 17 ++++++++--------- lib/init-action-post.js | 2 +- lib/init-action.js | 15 +++++---------- src/analyze-action.ts | 6 ++---- src/dependency-caching.ts | 34 +++++++++++++++------------------- src/init-action-post-helper.ts | 3 ++- src/init-action-post.ts | 2 +- src/status-report.ts | 6 ++---- 8 files changed, 36 insertions(+), 49 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index bf59496d50..bc09ce15de 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -93330,7 +93330,7 @@ async function makeGlobber(patterns) { return glob.create(patterns.join("\n")); } async function uploadDependencyCaches(config, logger, minimizeJavaJars) { - const status = {}; + const status = []; for (const language of config.languages) { const cacheConfig = getDefaultCacheConfig()[language]; if (cacheConfig === void 0) { @@ -93341,7 +93341,7 @@ async function uploadDependencyCaches(config, logger, minimizeJavaJars) { } const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { - status[language] = { result: "no-hash" /* NoHash */ }; + status.push({ language, result: "no-hash" /* NoHash */ }); logger.info( `Skipping upload of dependency cache for ${language} as we cannot calculate a hash for the cache key.` ); @@ -93349,7 +93349,7 @@ async function uploadDependencyCaches(config, logger, minimizeJavaJars) { } const size = await getTotalCacheSize(cacheConfig.paths, logger, true); if (size === 0) { - status[language] = { result: "empty" /* Empty */ }; + status.push({ language, result: "empty" /* Empty */ }); logger.info( `Skipping upload of dependency cache for ${language} since it is empty.` ); @@ -93363,18 +93363,19 @@ async function uploadDependencyCaches(config, logger, minimizeJavaJars) { const start = performance.now(); await actionsCache3.saveCache(cacheConfig.paths, key); const upload_duration_ms = Math.round(performance.now() - start); - status[language] = { + status.push({ + language, result: "stored" /* Stored */, upload_size_bytes: Math.round(size), upload_duration_ms - }; + }); } catch (error2) { if (error2 instanceof actionsCache3.ReserveCacheError) { logger.info( `Not uploading cache for ${language}, because ${key} is already in use.` ); logger.debug(error2.message); - status[language] = { result: "duplicate" /* Duplicate */ }; + status.push({ language, result: "duplicate" /* Duplicate */ }); } else { throw error2; } @@ -95963,9 +95964,7 @@ async function sendStatusReport2(startedAt, config, stats, error2, trapCacheUplo ...stats || {}, ...dbCreationTimings || {}, ...trapCacheCleanup || {}, - dependency_caching_upload_results: JSON.stringify( - dependencyCacheResults ?? {} - ) + dependency_caching_upload_results: dependencyCacheResults }; if (config && didUploadTrapCaches) { const trapCacheUploadStatusReport = { diff --git a/lib/init-action-post.js b/lib/init-action-post.js index ae5bee7487..8194dffd7c 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -133803,7 +133803,7 @@ async function runWrapper() { ...statusReportBase, ...uploadFailedSarifResult, job_status: getFinalJobStatus(), - dependency_caching_usage: JSON.stringify(dependencyCachingUsage ?? {}) + dependency_caching_usage: dependencyCachingUsage }; logger.info("Sending status report for init-post step."); await sendStatusReport(statusReport); diff --git a/lib/init-action.js b/lib/init-action.js index 994a68e6db..e0e99987aa 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88175,7 +88175,7 @@ async function makeGlobber(patterns) { return glob.create(patterns.join("\n")); } async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { - const status = {}; + const status = []; for (const language of languages) { const cacheConfig = getDefaultCacheConfig()[language]; if (cacheConfig === void 0) { @@ -88186,7 +88186,7 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { } const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { - status[language] = { hit_kind: "no-hash" /* NoHash */ }; + status.push({ language, hit_kind: "no-hash" /* NoHash */ }); logger.info( `Skipping download of dependency cache for ${language} as we cannot calculate a hash for the cache key.` ); @@ -88211,12 +88211,9 @@ async function downloadDependencyCaches(languages, logger, minimizeJavaJars) { if (hitKey !== void 0) { logger.info(`Cache hit on key ${hitKey} for ${language}.`); const hit_kind = hitKey === primaryKey ? "exact" /* Exact */ : "partial" /* Partial */; - status[language] = { - hit_kind, - download_duration_ms - }; + status.push({ language, hit_kind, download_duration_ms }); } else { - status[language] = { hit_kind: "miss" /* Miss */ }; + status.push({ language, hit_kind: "miss" /* Miss */ }); logger.info(`No suitable cache found for ${language}.`); } } @@ -90361,9 +90358,7 @@ async function createInitWithConfigStatusReport(config, initStatusReport, config trap_cache_download_duration_ms: Math.round(config.trapCacheDownloadTime), overlay_base_database_download_size_bytes: overlayBaseDatabaseStats?.databaseSizeBytes, overlay_base_database_download_duration_ms: overlayBaseDatabaseStats?.databaseDownloadDurationMs, - dependency_caching_restore_results: JSON.stringify( - dependencyCachingResults ?? {} - ), + dependency_caching_restore_results: dependencyCachingResults, query_filters: JSON.stringify( config.originalUserInput["query-filters"] ?? [] ), diff --git a/src/analyze-action.ts b/src/analyze-action.ts index 6422981ceb..bb5ee2d91e 100644 --- a/src/analyze-action.ts +++ b/src/analyze-action.ts @@ -59,7 +59,7 @@ interface AnalysisStatusReport QueriesStatusReport {} interface DependencyCachingUploadStatusReport { - dependency_caching_upload_results?: string; + dependency_caching_upload_results?: DependencyCacheUploadStatusReport; } interface FinishStatusReport @@ -104,9 +104,7 @@ async function sendStatusReport( ...(stats || {}), ...(dbCreationTimings || {}), ...(trapCacheCleanup || {}), - dependency_caching_upload_results: JSON.stringify( - dependencyCacheResults ?? {}, - ), + dependency_caching_upload_results: dependencyCacheResults, }; if (config && didUploadTrapCaches) { const trapCacheUploadStatusReport: FinishWithTrapUploadStatusReport = { diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index dedd1075c4..df82e0d57b 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -99,14 +99,13 @@ export enum CacheHitKind { /** Represents results of trying to restore a dependency cache for a language. */ export interface DependencyCacheRestoreStatus { + language: Language; hit_kind: CacheHitKind; download_duration_ms?: number; } /** A partial mapping from languages to the results of restoring dependency caches for them. */ -export type DependencyCacheRestoreStatusReport = Partial< - Record ->; +export type DependencyCacheRestoreStatusReport = DependencyCacheRestoreStatus[]; /** * Attempts to restore dependency caches for the languages being analyzed. @@ -121,7 +120,7 @@ export async function downloadDependencyCaches( logger: Logger, minimizeJavaJars: boolean, ): Promise { - const status: DependencyCacheRestoreStatusReport = {}; + const status: DependencyCacheRestoreStatusReport = []; for (const language of languages) { const cacheConfig = getDefaultCacheConfig()[language]; @@ -138,7 +137,7 @@ export async function downloadDependencyCaches( const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { - status[language] = { hit_kind: CacheHitKind.NoHash }; + status.push({ language, hit_kind: CacheHitKind.NoHash }); logger.info( `Skipping download of dependency cache for ${language} as we cannot calculate a hash for the cache key.`, ); @@ -168,12 +167,9 @@ export async function downloadDependencyCaches( logger.info(`Cache hit on key ${hitKey} for ${language}.`); const hit_kind = hitKey === primaryKey ? CacheHitKind.Exact : CacheHitKind.Partial; - status[language] = { - hit_kind, - download_duration_ms, - }; + status.push({ language, hit_kind, download_duration_ms }); } else { - status[language] = { hit_kind: CacheHitKind.Miss }; + status.push({ language, hit_kind: CacheHitKind.Miss }); logger.info(`No suitable cache found for ${language}.`); } } @@ -195,15 +191,14 @@ export enum CacheStoreResult { /** Represents results of trying to upload a dependency cache for a language. */ export interface DependencyCacheUploadStatus { + language: Language; result: CacheStoreResult; upload_size_bytes?: number; upload_duration_ms?: number; } /** A partial mapping from languages to the results of uploading dependency caches for them. */ -export type DependencyCacheUploadStatusReport = Partial< - Record ->; +export type DependencyCacheUploadStatusReport = DependencyCacheUploadStatus[]; /** * Attempts to store caches for the languages that were analyzed. @@ -219,7 +214,7 @@ export async function uploadDependencyCaches( logger: Logger, minimizeJavaJars: boolean, ): Promise { - const status: DependencyCacheUploadStatusReport = {}; + const status: DependencyCacheUploadStatusReport = []; for (const language of config.languages) { const cacheConfig = getDefaultCacheConfig()[language]; @@ -235,7 +230,7 @@ export async function uploadDependencyCaches( const globber = await makeGlobber(cacheConfig.hash); if ((await globber.glob()).length === 0) { - status[language] = { result: CacheStoreResult.NoHash }; + status.push({ language, result: CacheStoreResult.NoHash }); logger.info( `Skipping upload of dependency cache for ${language} as we cannot calculate a hash for the cache key.`, ); @@ -256,7 +251,7 @@ export async function uploadDependencyCaches( // Skip uploading an empty cache. if (size === 0) { - status[language] = { result: CacheStoreResult.Empty }; + status.push({ language, result: CacheStoreResult.Empty }); logger.info( `Skipping upload of dependency cache for ${language} since it is empty.`, ); @@ -274,11 +269,12 @@ export async function uploadDependencyCaches( await actionsCache.saveCache(cacheConfig.paths, key); const upload_duration_ms = Math.round(performance.now() - start); - status[language] = { + status.push({ + language, result: CacheStoreResult.Stored, upload_size_bytes: Math.round(size), upload_duration_ms, - }; + }); } catch (error) { // `ReserveCacheError` indicates that the cache key is already in use, which means that a // cache with that key already exists or is in the process of being uploaded by another @@ -289,7 +285,7 @@ export async function uploadDependencyCaches( ); logger.debug(error.message); - status[language] = { result: CacheStoreResult.Duplicate }; + status.push({ language, result: CacheStoreResult.Duplicate }); } else { // Propagate other errors upwards. throw error; diff --git a/src/init-action-post-helper.ts b/src/init-action-post-helper.ts index 3b1d6aea72..97bf21adac 100644 --- a/src/init-action-post-helper.ts +++ b/src/init-action-post-helper.ts @@ -8,6 +8,7 @@ import { CodeScanning } from "./analyses"; import { getApiClient } from "./api-client"; import { CodeQL, getCodeQL } from "./codeql"; import { Config } from "./config-utils"; +import * as dependencyCaching from "./dependency-caching"; import { EnvVar } from "./environment"; import { Feature, FeatureEnablement } from "./feature-flags"; import { Logger } from "./logging"; @@ -46,7 +47,7 @@ export interface JobStatusReport { } export interface DependencyCachingUsageReport { - dependency_caching_usage?: string; + dependency_caching_usage?: dependencyCaching.DependencyCachingUsageReport; } function createFailedUploadFailedSarifResult( diff --git a/src/init-action-post.ts b/src/init-action-post.ts index 74759bb3c7..9a93f38bc7 100644 --- a/src/init-action-post.ts +++ b/src/init-action-post.ts @@ -128,7 +128,7 @@ async function runWrapper() { ...statusReportBase, ...uploadFailedSarifResult, job_status: initActionPostHelper.getFinalJobStatus(), - dependency_caching_usage: JSON.stringify(dependencyCachingUsage ?? {}), + dependency_caching_usage: dependencyCachingUsage, }; logger.info("Sending status report for init-post step."); await sendStatusReport(statusReport); diff --git a/src/status-report.ts b/src/status-report.ts index 41f63a20a9..b795779ef8 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -499,7 +499,7 @@ export interface InitWithConfigStatusReport extends InitStatusReport { /** Time taken to download the overlay-base database, in milliseconds. */ overlay_base_database_download_duration_ms?: number; /** Stringified JSON object representing information about the results of restoring dependency caches. */ - dependency_caching_restore_results: string; + dependency_caching_restore_results?: DependencyCacheRestoreStatusReport; /** Stringified JSON array of registry configuration objects, from the 'registries' config field or workflow input. **/ registries: string; @@ -574,9 +574,7 @@ export async function createInitWithConfigStatusReport( overlayBaseDatabaseStats?.databaseSizeBytes, overlay_base_database_download_duration_ms: overlayBaseDatabaseStats?.databaseDownloadDurationMs, - dependency_caching_restore_results: JSON.stringify( - dependencyCachingResults ?? {}, - ), + dependency_caching_restore_results: dependencyCachingResults, query_filters: JSON.stringify( config.originalUserInput["query-filters"] ?? [], ), From d44c8b3e185a4cc2068b99d018ce6a237caabd85 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 29 Sep 2025 15:45:02 +0100 Subject: [PATCH 8/8] Fix comments --- src/dependency-caching.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dependency-caching.ts b/src/dependency-caching.ts index df82e0d57b..5c7a4a4e88 100644 --- a/src/dependency-caching.ts +++ b/src/dependency-caching.ts @@ -104,7 +104,7 @@ export interface DependencyCacheRestoreStatus { download_duration_ms?: number; } -/** A partial mapping from languages to the results of restoring dependency caches for them. */ +/** An array of `DependencyCacheRestoreStatus` objects for each analysed language with a caching configuration. */ export type DependencyCacheRestoreStatusReport = DependencyCacheRestoreStatus[]; /** @@ -113,7 +113,7 @@ export type DependencyCacheRestoreStatusReport = DependencyCacheRestoreStatus[]; * @param languages The languages being analyzed. * @param logger A logger to record some informational messages to. * @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size. - * @returns A partial mapping of languages to results of restoring dependency caches for them. + * @returns An array of `DependencyCacheRestoreStatus` objects for each analysed language with a caching configuration. */ export async function downloadDependencyCaches( languages: Language[], @@ -197,7 +197,7 @@ export interface DependencyCacheUploadStatus { upload_duration_ms?: number; } -/** A partial mapping from languages to the results of uploading dependency caches for them. */ +/** An array of `DependencyCacheUploadStatus` objects for each analysed language with a caching configuration. */ export type DependencyCacheUploadStatusReport = DependencyCacheUploadStatus[]; /** @@ -207,7 +207,7 @@ export type DependencyCacheUploadStatusReport = DependencyCacheUploadStatus[]; * @param logger A logger to record some informational messages to. * @param minimizeJavaJars Whether the Java extractor should rewrite downloaded JARs to minimize their size. * - * @returns A partial mapping of languages to results of uploading dependency caches for them. + * @returns An array of `DependencyCacheUploadStatus` objects for each analysed language with a caching configuration. */ export async function uploadDependencyCaches( config: Config,