1
0
Fork 0

adds better info messages. reduces retry timeout for simple download. makes cache miss record instead of failing workflow

pull/1935/head
Prajjwal 2024-05-17 18:07:39 +05:30
parent e5677fba9b
commit f120696e60
3 changed files with 20 additions and 12 deletions

View File

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

View File

@ -225,8 +225,9 @@ export async function restoreCache(
downloadCommandPipe
)
} catch (error) {
core.debug(`Failed to download cache: ${error}`)
core.info(
`Streaming download failed. Retrying with multipart: ${error}`
`Streaming download failed. Likely a cloud provider issue. Retrying with multipart download`
)
// Wait 1 second
await new Promise(resolve => setTimeout(resolve, 1000))
@ -239,16 +240,24 @@ export async function restoreCache(
cacheEntry.gcs?.short_lived_token?.access_token ?? ''
)
} catch (error) {
core.debug(`Failed to download cache: ${error}`)
core.info(
`Multipart Download failed. Retrying with basic download: ${error}`
`Multipart download failed. Likely a cloud provider issue. Retrying with basic download`
)
// Wait 1 second
await new Promise(resolve => setTimeout(resolve, 1000))
await cacheHttpClient.downloadCacheSingleThread(
cacheEntry.provider,
archiveLocation,
archivePath,
cacheEntry.gcs?.short_lived_token?.access_token ?? ''
)
// Try to download the cache using the basic method
try {
await cacheHttpClient.downloadCacheSingleThread(
cacheEntry.provider,
archiveLocation,
archivePath,
cacheEntry.gcs?.short_lived_token?.access_token ?? ''
)
} catch (error) {
core.info('Cache Miss. Failed to download cache.')
return undefined
}
}
if (core.isDebug()) {

View File

@ -317,7 +317,6 @@ export async function downloadCacheMultipartGCP(
})
} catch (error) {
core.debug(`Failed to download cache: ${error}`)
core.error(`Failed to download cache.`)
throw error
}
}
@ -331,13 +330,14 @@ export async function downloadCacheGCP(
const {bucketName, objectName} =
utils.retrieveGCSBucketAndObjectName(archiveLocation)
storage.retryOptions.totalTimeout = 120
await storage.bucket(bucketName).file(objectName).download({
destination: archivePath,
validation: 'crc32c'
})
} catch (error) {
core.debug(`Failed to download cache: ${error}`)
core.error(`Failed to download cache.`)
throw error
}
}
@ -367,7 +367,6 @@ export function downloadCacheStreamingGCP(
return storage.bucket(bucketName).file(objectName).createReadStream()
} catch (error) {
core.debug(`Failed to download cache: ${error}`)
core.error(`Failed to download cache.`)
throw error
}
}