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", "name": "github-actions.warp-cache",
"version": "1.1.7", "version": "1.1.8",
"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

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

View File

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