From 514314311c88fae0858ae57bc09749be9c30689a Mon Sep 17 00:00:00 2001 From: Art Leo Date: Sat, 15 Mar 2025 10:13:43 +1100 Subject: [PATCH] Log cache version requested --- packages/cache/__tests__/restoreCacheV2.test.ts | 9 ++++++++- packages/cache/src/cache.ts | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/cache/__tests__/restoreCacheV2.test.ts b/packages/cache/__tests__/restoreCacheV2.test.ts index 64e9df15..485b8aeb 100644 --- a/packages/cache/__tests__/restoreCacheV2.test.ts +++ b/packages/cache/__tests__/restoreCacheV2.test.ts @@ -115,6 +115,10 @@ test('restore with restore keys and no cache found', async () => { const paths = ['node_modules'] const key = 'node-test' const restoreKeys = ['node-'] + const cacheVersion = + 'd90f107aaeb22920dba0c637a23c37b5bc497b4dfa3b07fe3f79bf88a273c11b' + const getCacheVersionMock = jest.spyOn(cacheUtils, 'getCacheVersion') + getCacheVersionMock.mockReturnValue(cacheVersion) jest .spyOn(CacheServiceClientJSON.prototype, 'GetCacheEntryDownloadURL') @@ -130,7 +134,10 @@ test('restore with restore keys and no cache found', async () => { expect(cacheKey).toBe(undefined) expect(logDebugMock).toHaveBeenCalledWith( - `Cache not found for keys: ${[key, ...restoreKeys].join(', ')}` + `Cache not found for version ${cacheVersion} of keys: ${[ + key, + ...restoreKeys + ].join(', ')}` ) }) diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index 9cbab6e0..f7b2d193 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -256,7 +256,11 @@ async function restoreCacheV2( const response = await twirpClient.GetCacheEntryDownloadURL(request) if (!response.ok) { - core.debug(`Cache not found for keys: ${keys.join(', ')}`) + core.debug( + `Cache not found for version ${request.version} of keys: ${keys.join( + ', ' + )}` + ) return undefined }