From 45d20191613fcb6bd15d47f1d40e68c713054732 Mon Sep 17 00:00:00 2001 From: Aparna Ravindra <82894348+aparna-ravindra@users.noreply.github.com> Date: Fri, 19 Nov 2021 16:34:33 +0530 Subject: [PATCH] Cache: Increasing client validation to 10GB (#934) * increasing client validation limit in cache package to 10gb --- packages/cache/README.md | 2 +- packages/cache/RELEASES.md | 3 +++ packages/cache/__tests__/saveCache.test.ts | 4 ++-- packages/cache/package-lock.json | 2 +- packages/cache/package.json | 2 +- packages/cache/src/cache.ts | 4 ++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/cache/README.md b/packages/cache/README.md index 1fa1eead..541b1155 100644 --- a/packages/cache/README.md +++ b/packages/cache/README.md @@ -4,7 +4,7 @@ See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows) for how caching works. -Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 5 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 5 GB. +Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 10 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 10 GB. ## Usage diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index 201b1a8d..5743cf3c 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -40,3 +40,6 @@ ### 1.0.7 - Fixes permissions issue extracting archives with GNU tar on macOS ([issue](https://github.com/actions/cache/issues/527)) + +### 1.0.8 +- Increase the allowed artifact cache size from 5GB to 10GB ([issue](https://github.com/actions/cache/discussions/497)) diff --git a/packages/cache/__tests__/saveCache.test.ts b/packages/cache/__tests__/saveCache.test.ts index 22fcbd91..d9dd5708 100644 --- a/packages/cache/__tests__/saveCache.test.ts +++ b/packages/cache/__tests__/saveCache.test.ts @@ -46,7 +46,7 @@ test('save with large cache outputs should fail', async () => { const createTarMock = jest.spyOn(tar, 'createTar') - const cacheSize = 6 * 1024 * 1024 * 1024 //~6GB, over the 5GB limit + const cacheSize = 11 * 1024 * 1024 * 1024 //~11GB, over the 10GB limit jest .spyOn(cacheUtils, 'getArchiveFileSizeInBytes') .mockReturnValueOnce(cacheSize) @@ -56,7 +56,7 @@ test('save with large cache outputs should fail', async () => { .mockReturnValueOnce(Promise.resolve(compression)) await expect(saveCache([filePath], primaryKey)).rejects.toThrowError( - 'Cache size of ~6144 MB (6442450944 B) is over the 5GB limit, not saving cache.' + 'Cache size of ~11264 MB (11811160064 B) is over the 10GB limit, not saving cache.' ) const archiveFolder = '/foo/bar' diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index 8a5f44a9..b842689c 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "1.0.7", + "version": "1.0.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/cache/package.json b/packages/cache/package.json index 7b03e2f5..fb223330 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "1.0.7", + "version": "1.0.8", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/packages/cache/src/cache.ts b/packages/cache/src/cache.ts index 951ef29c..540d639c 100644 --- a/packages/cache/src/cache.ts +++ b/packages/cache/src/cache.ts @@ -172,14 +172,14 @@ export async function saveCache( await listTar(archivePath, compressionMethod) } - const fileSizeLimit = 5 * 1024 * 1024 * 1024 // 5GB per repo limit + const fileSizeLimit = 10 * 1024 * 1024 * 1024 // 10GB per repo limit const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath) core.debug(`File Size: ${archiveFileSize}`) if (archiveFileSize > fileSizeLimit) { throw new Error( `Cache size of ~${Math.round( archiveFileSize / (1024 * 1024) - )} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.` + )} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.` ) }