1
0
Fork 0

adds backup download method for streaming cache

pull/1935/head
Prajjwal 2024-05-17 16:37:56 +05:30
parent 868b4d32d5
commit 890c6b520f
2 changed files with 31 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "github-actions.warp-cache", "name": "github-actions.warp-cache",
"version": "1.1.3", "version": "1.1.4",
"preview": true, "preview": true,
"description": "Github action to use WarpBuild's in-house cache offering", "description": "Github action to use WarpBuild's in-house cache offering",
"keywords": [ "keywords": [

View File

@ -217,12 +217,36 @@ export async function restoreCache(
} }
} }
await extractStreamingTar( try {
readStream, await extractStreamingTar(
archivePath, readStream,
compressionMethod, archivePath,
downloadCommandPipe compressionMethod,
) downloadCommandPipe
)
} catch (error) {
core.info(`Streaming download failed. Retrying: ${error}`)
// Try to download the cache using the non-streaming method
await cacheHttpClient.downloadCache(
cacheEntry.provider,
archiveLocation,
archivePath,
cacheEntry.gcs?.short_lived_token?.access_token ?? ''
)
if (core.isDebug()) {
await listTar(archivePath, compressionMethod)
}
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath)
core.info(
`Cache Size: ~${Math.round(
archiveFileSize / (1024 * 1024)
)} MB (${archiveFileSize} B)`
)
await extractTar(archivePath, compressionMethod)
}
core.info('Cache restored successfully') core.info('Cache restored successfully')
break break
} }