From a64055103da6d7744acf7af09185a910932efbfa Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:09:30 +0000 Subject: [PATCH] Added env var for using Http client --- packages/cache/README.md | 2 ++ packages/cache/src/internal/cacheHttpClient.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cache/README.md b/packages/cache/README.md index 5fec54ae..ede97eeb 100644 --- a/packages/cache/README.md +++ b/packages/cache/README.md @@ -47,3 +47,5 @@ const cacheKey = await cache.restoreCache(paths, key, restoreKeys) A cache gets downloaded in multiple segments of fixed sizes (`1GB` for a `32-bit` runner and `2GB` for a `64-bit` runner). Sometimes, a segment download gets stuck which causes the workflow job to be stuck forever and fail. Version `v3.0.4` of cache package introduces a segment download timeout. The segment download timeout will allow the segment download to get aborted and hence allow the job to proceed with a cache miss. Default value of this timeout is 60 minutes and can be customized by specifying an [environment variable](https://docs.github.com/en/actions/learn-github-actions/environment-variables) named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with timeout value in minutes. + +We are also introducing a new variable `DOWNLOAD_WITH_HTTP_CLIENT`, which if set to `true` downloads the cache using plain http-client and not Azure SDK. This has been introduced keeping in mind the problem Azure SDK is causing in downloads getting stuck infinitely. \ No newline at end of file diff --git a/packages/cache/src/internal/cacheHttpClient.ts b/packages/cache/src/internal/cacheHttpClient.ts index c66d1a73..a5dfaca7 100644 --- a/packages/cache/src/internal/cacheHttpClient.ts +++ b/packages/cache/src/internal/cacheHttpClient.ts @@ -132,7 +132,7 @@ export async function downloadCache( if ( downloadOptions.useAzureSdk && - archiveUrl.hostname.endsWith('.blob.core.windows.net') + archiveUrl.hostname.endsWith('.blob.core.windows.net') && !process.env['DOWNLOAD_WITH_HTTP_CLIENT'] ) { // Use Azure storage SDK to download caches hosted on Azure to improve speed and reliability. await downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions)