1
0
Fork 0

Add fix cache paths

Link-/blobcache-spike
Bassem Dghaidi 2024-06-17 03:36:06 -07:00 committed by GitHub
parent e1b7e78d60
commit 04d1a7ec3c
2 changed files with 5 additions and 3 deletions

View File

@ -223,8 +223,9 @@ async function restoreCachev2(
return undefined return undefined
} }
core.info(`Cache hit for: ${signedDownloadURL.blobs[0].key}`)
core.info(`Starting download of artifact to: ${paths[0]}`) core.info(`Starting download of artifact to: ${paths[0]}`)
await StreamExtract(signedDownloadURL.blobs[0].signedUrl, paths[0]) await StreamExtract(signedDownloadURL.blobs[0].signedUrl, path.dirname(paths[0]))
core.info(`Artifact download completed successfully.`) core.info(`Artifact download completed successfully.`)
return keys[0] return keys[0]

View File

@ -11,7 +11,7 @@ export async function StreamExtract(url: string, directory: string): Promise<voi
return return
} catch (error) { } catch (error) {
retryCount++ retryCount++
core.debug( core.info(
`Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...` `Failed to download cache after ${retryCount} retries due to ${error.message}. Retrying in 5 seconds...`
) )
// wait 5 seconds before retrying // wait 5 seconds before retrying
@ -29,6 +29,7 @@ export async function streamExtractExternal(
const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`) const client = new httpClient.HttpClient(`@actions/cache-${packageJson.version}`)
const response = await client.get(url) const response = await client.get(url)
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
core.info(`Failed to download cache. HTTP status code: ${response.message.statusCode}`)
throw new Error( throw new Error(
`Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}` `Unexpected HTTP response from blob storage: ${response.message.statusCode} ${response.message.statusMessage}`
) )
@ -49,7 +50,7 @@ export async function streamExtractExternal(
timer.refresh() timer.refresh()
}) })
.on('error', (error: Error) => { .on('error', (error: Error) => {
core.debug( core.info(
`response.message: Cache download failed: ${error.message}` `response.message: Cache download failed: ${error.message}`
) )
clearTimeout(timer) clearTimeout(timer)