diff --git a/packages/warp-cache/package.json b/packages/warp-cache/package.json index fca795e3..29bf4a65 100644 --- a/packages/warp-cache/package.json +++ b/packages/warp-cache/package.json @@ -1,6 +1,6 @@ { "name": "github-actions.warp-cache", - "version": "1.1.3", + "version": "1.1.4", "preview": true, "description": "Github action to use WarpBuild's in-house cache offering", "keywords": [ diff --git a/packages/warp-cache/src/cache.ts b/packages/warp-cache/src/cache.ts index cc6151f2..715015df 100644 --- a/packages/warp-cache/src/cache.ts +++ b/packages/warp-cache/src/cache.ts @@ -217,12 +217,36 @@ export async function restoreCache( } } - await extractStreamingTar( - readStream, - archivePath, - compressionMethod, - downloadCommandPipe - ) + try { + await extractStreamingTar( + readStream, + archivePath, + 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') break }