Skip to content

Commit

Permalink
Cache: Increasing client validation to 10GB (actions#934)
Browse files Browse the repository at this point in the history
* increasing client validation limit in cache package to 10gb
  • Loading branch information
aparna-ravindra authored Nov 19, 2021
1 parent e2eeb0a commit 45d2019
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions packages/cache/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
4 changes: 2 additions & 2 deletions packages/cache/__tests__/saveCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actions/cache",
"version": "1.0.7",
"version": "1.0.8",
"preview": true,
"description": "Actions cache lib",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions packages/cache/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
)
}

Expand Down

0 comments on commit 45d2019

Please sign in to comment.