Compare commits

..

107 Commits

Author SHA1 Message Date
Sankalp Kotewar 64a59d5b55 Merge pull request #1034 from actions/kotewar/save-warnings
Warning added for save only action
2022-12-21 15:45:16 +05:30
Sankalp Kotewar b388bcadaf Removed comment 2022-12-21 08:19:27 +00:00
Sankalp Kotewar f9ae5e0028 Removed -2 error code 2022-12-21 08:18:24 +00:00
Sankalp Kotewar 34faf3ad7c Updated return ID to -2 2022-12-21 06:25:59 +00:00
Sankalp Kotewar 1d114a8000 Save-only warning added 2022-12-20 16:15:42 +00:00
Sankalp Kotewar 8955114d15 Merge pull request #1029 from actions/kotewar/test-case-fixes
Added StateProvider mock implementations for states
2022-12-19 20:36:01 +05:30
Sankalp Kotewar 3f0eaf4956 Linting errors fixed 2022-12-19 04:23:16 +00:00
Sankalp Kotewar 770b3a8151 Added stateprovider mock implementations 2022-12-19 04:19:49 +00:00
Sankalp Kotewar ed5e94a5f5 Merge pull request #1006 from actions/700-actionscache-granular-cache-control
Actions Cache Granular Control Implementation
2022-12-15 16:22:14 +05:30
Sankalp Kotewar 6277f55919 Updated beta version to 3.2.0-beta.1 2022-12-15 10:11:38 +00:00
Sankalp Kotewar c30e6dcb11 Merge pull request #1017 from actions/kotewar/readme-updates-for-granular-control
Readme updates for granular control
2022-12-15 14:38:13 +05:30
Sankalp Kotewar 05c9b49ea4 nit: added language to code blocks 2022-12-15 09:05:17 +00:00
Sankalp Kotewar da311f75a6 nit 2022-12-15 09:01:49 +00:00
Sankalp Kotewar 7a139a9cec Addressed review comments 2022-12-15 08:59:40 +00:00
Sankalp Kotewar 930f080bad Added test case for restore state 2022-12-15 04:12:52 +00:00
Sankalp Kotewar 56e956426f Repositioned new actions introduction 2022-12-14 18:49:43 +00:00
Sankalp Kotewar 766d8255cd Removed verbose statements 2022-12-14 18:46:21 +00:00
Sankalp Kotewar 686bf424a8 Update save/README.md
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-15 00:07:16 +05:30
Sankalp Kotewar fb5b333162 Update save/README.md
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-15 00:07:06 +05:30
Sankalp Kotewar c11ac6c2fe Update restore/README.md
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-15 00:06:56 +05:30
Sankalp Kotewar d5c949690c Update restore/README.md
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-15 00:06:41 +05:30
Sankalp Kotewar 44df5ab77e Update restore/README.md
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-15 00:06:10 +05:30
Sankalp Kotewar 65057ce6fe Added cache hit info in readme 2022-12-14 10:23:32 +00:00
Sankalp Kotewar 8031e403b4 Merge remote-tracking branch 'origin/700-actionscache-granular-cache-control' into kotewar/readme-updates-for-granular-control 2022-12-14 10:19:50 +00:00
Sankalp Kotewar c8d01facfc Renamed output 2022-12-14 09:17:49 +00:00
Sankalp Kotewar 81aaae062b Updates to save readme 2022-12-14 04:40:58 +00:00
Sankalp Kotewar 9d445b2565 Added save readme 2022-12-14 04:35:02 +00:00
Sankalp Kotewar adecab4b4a Merge remote-tracking branch 'origin/700-actionscache-granular-cache-control' into kotewar/readme-updates-for-granular-control 2022-12-12 14:22:14 +00:00
Sankalp Kotewar 075ad790b0 Merged beta branch and resolved conflicts 2022-12-12 14:18:42 +00:00
Sankalp Kotewar b275c83bd6 Merge remote-tracking branch 'origin/releases/v3-beta' into 700-actionscache-granular-cache-control 2022-12-12 14:18:23 +00:00
Sankalp Kotewar 1ddc49105d Removed unused code 2022-12-12 14:03:16 +00:00
Sankalp Kotewar 407044787b Added more assertions as values can't be checked 2022-12-12 13:50:54 +00:00
Sankalp Kotewar 87a7d01109 Update restore/action.yml
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-12 18:50:18 +05:30
Sankalp Kotewar 29d6c7aa7f Update restore/action.yml
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-12 18:50:09 +05:30
Sankalp Kotewar df53d3c04b Update restore/action.yml
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-12 18:49:59 +05:30
Sankalp Kotewar dd740c87de Update restore/action.yml
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-12 18:49:53 +05:30
Sankalp Kotewar 0a6e5b052a Update save/action.yml
Co-authored-by: Bishal Prasad <bishal-pdmsft@github.com>
2022-12-12 18:49:45 +05:30
Sampark Sharma a2137c625c update for new beta release 2022-12-12 13:01:08 +00:00
Sampark Sharma 5a2b5e5714 Add support for gzip fallback for restore of old cache on windows 2022-12-12 12:57:44 +00:00
Sampark Sharma 9e9a19bf5f Update dist folder 2022-12-12 12:57:44 +00:00
Sampark Sharma 84ea3e177d Changes for beta release 2022-12-12 12:57:43 +00:00
Sankalp Kotewar 00b72c7e02 Updated outputs of restore action 2022-12-12 11:36:12 +00:00
Sankalp Kotewar 0cc9c1d4e8 Merge remote-tracking branch 'origin/700-actionscache-granular-cache-control' into kotewar/readme-updates-for-granular-control 2022-12-12 11:33:04 +00:00
Sankalp Kotewar ccf90c02ed Fixed breaking test case 2022-12-12 10:01:21 +00:00
Sankalp Kotewar 4f42dc56c1 Added stateprovider test cases 2022-12-12 09:53:50 +00:00
Sankalp Kotewar b6604364ae Deleted stateprovider tests until added 2022-12-12 07:28:47 +00:00
Sankalp Kotewar c0cc8dd60a added stateprovider changes 2022-12-12 07:28:12 +00:00
Sankalp Kotewar 91d7bd61be Fixed review comments and tests 2022-12-12 07:26:18 +00:00
Sankalp Kotewar 5e7f2c1182 Fixed breaking test case 2022-12-11 16:47:35 +00:00
Sankalp Kotewar 3d4af52c52 Renamed variables and added tests 2022-12-11 13:33:36 +00:00
Sankalp Kotewar d91f5bd2fd Fixed inputs 2022-12-09 13:56:33 +00:00
Sankalp Kotewar 61aa90bfc3 Removed comments 2022-12-09 12:59:43 +00:00
Sankalp Kotewar 0c2d18e609 Merge pull request #1024 from actions/kotewar/save-changes
Granular cache control save related changes and new inputs
2022-12-09 18:22:02 +05:30
Sankalp Kotewar 804322aab0 Updated new actions dist files 2022-12-09 09:42:25 +00:00
Sankalp Kotewar f426a0deb2 Merge remote-tracking branch 'origin/700-actionscache-granular-cache-control' into kotewar/save-changes 2022-12-09 09:40:50 +00:00
Sankalp Kotewar be72d0432d Merge remote-tracking branch 'origin/releases/v3-beta' into 700-actionscache-granular-cache-control 2022-12-09 09:38:08 +00:00
Sankalp Kotewar 8ecd00a4be Added restore only and save only test cases 2022-12-08 17:56:21 +00:00
Sankalp Kotewar 12a1a354bd Fixed test cases 2022-12-08 17:39:12 +00:00
Sankalp Kotewar 782b0bd3df Fixed test cases 2022-12-08 17:30:24 +00:00
Sampark Sharma f33ca902b8 Merge pull request #1022 from actions/phantsure/v3-beta
Release cache `3.1.0-beta.2` with gzip fallback for old cache
2022-12-08 15:39:59 +05:30
Sampark Sharma d48d03435b Add support for gzip fallback for restore of old cache on windows 2022-12-08 09:54:44 +00:00
Sankalp Kotewar 6f77edac15 dist 2022-12-08 08:33:23 +00:00
Sankalp Kotewar 6e12d27152 Fixed formatting 2022-12-08 08:24:43 +00:00
Sankalp Kotewar c346bf01e0 Merge remote-tracking branch 'origin/releases/v3-beta' into 700-actionscache-granular-cache-control 2022-12-08 07:48:07 +00:00
Sampark Sharma 593e91a38b Update dist folder 2022-12-08 07:28:04 +00:00
Sampark Sharma e4c2242eff Changes for beta release 2022-12-08 07:28:03 +00:00
Tanuj Kumar Mishra 66ef8a0951 Merge pull request #1018 from actions/bishal/outputter
Update save with a wrapper layer
2022-12-07 17:03:07 +05:30
Bishal Prasad 657c52f11e fix merge 2022-12-06 18:45:12 +00:00
Bishal Prasad 34e917cb7d Merge branch '700-actionscache-granular-cache-control' into bishal/outputter 2022-12-06 18:42:19 +00:00
Bishal Prasad ac8fc97c06 update save as well 2022-12-06 18:26:58 +00:00
Sankalp Kotewar 86712a0733 dist 2022-12-06 10:10:52 +00:00
Sankalp Kotewar d6e98d9302 Calling methods from same file 2022-12-06 10:08:26 +00:00
Sankalp Kotewar a76826ef46 Removed commented lines 2022-12-06 10:07:30 +00:00
Sankalp Kotewar e02e5113ed Removed return type in promise 2022-12-06 10:03:48 +00:00
Sankalp Kotewar 85ae5bbcea Fixed breaking test case 2022-12-06 09:36:37 +00:00
Sankalp Kotewar cce93fb2c7 Generated dist 2022-12-06 08:23:10 +00:00
Sankalp Kotewar e3d8fb0b34 Merge pull request #1016 from actions/bishal/outputter
Refactor setting output and state into a generic outputter
2022-12-05 18:10:52 +05:30
Sankalp Kotewar 020a412c27 Readme draft for new actions 2022-12-05 12:34:45 +00:00
Bishal Prasad d95c048983 refactor into a generic outputter 2022-12-05 11:36:14 +00:00
Sankalp Kotewar 706c369cf1 Merge branch 'main' into 700-actionscache-granular-cache-control 2022-12-05 12:24:53 +05:30
Sankalp Kotewar 11ab7ccfa2 Reverted custom asks implemented and added wrapper 2022-12-02 10:14:43 +00:00
Sankalp Kotewar 4b5f33df54 Updated new actions' input descriptions 2022-12-01 08:27:08 +00:00
Sankalp Kotewar 56a0133650 Merge branch 'main' into 700-actionscache-granular-cache-control 2022-11-30 16:20:50 +05:30
Sankalp Kotewar 19446b165a Slight modification for test cases check 2022-11-30 10:47:09 +00:00
Sankalp Kotewar 8a88690a20 Fixed test cases issues 2022-11-30 08:38:59 +00:00
Sankalp Kotewar 6e2c6a5916 Formatted document 2022-11-30 08:30:16 +00:00
Sankalp Kotewar 2c9fb32186 Merge branch 'main' into 700-actionscache-granular-cache-control 2022-11-30 13:57:39 +05:30
Sankalp Kotewar 01d96636a0 Some cleanup 2022-11-30 08:26:50 +00:00
Sankalp Kotewar 9c5a42a7c9 Added test cases 2022-11-30 08:11:55 +00:00
Sankalp Kotewar a172494938 Reverted wrapper changes 2022-11-29 10:56:53 +00:00
Sankalp Kotewar f8717682fb Impl separated 2022-11-29 09:55:41 +00:00
Sankalp Kotewar af1210e2a3 test 2022-11-29 09:51:53 +00:00
Sankalp Kotewar ab0e7714ce new try 2022-11-29 09:39:21 +00:00
Sankalp Kotewar fb4a5dce60 test 2022-11-29 09:33:03 +00:00
Sankalp Kotewar 71334c58b2 Test 2022-11-29 09:06:10 +00:00
Sankalp Kotewar 888d454557 experimenting 2022-11-29 09:03:19 +00:00
Sankalp Kotewar dddd7ce07c added debug logs 2022-11-29 08:26:52 +00:00
Sankalp Kotewar abddc4dd44 Merge remote-tracking branch 'origin/master' into 700-actionscache-granular-cache-control 2022-11-29 08:08:32 +00:00
Sankalp Kotewar 921c58ee44 Changed logs to warnings 2022-11-29 08:06:41 +00:00
Sankalp Kotewar 7f45813c72 Adding wrapper class 2022-11-29 08:02:27 +00:00
Vipul 0769f2e443 Merge branch 'main' into master 2022-11-28 23:50:15 -08:00
Sankalp Kotewar 5fe0b944ef Updated variable name 2022-11-29 07:48:11 +00:00
Sankalp Kotewar 69b8227b27 Basic implementation 2022-11-25 09:16:56 +00:00
Vipul 515d10b4fd Merge pull request #746 from actions/revert-173-add-stack-example
Revert "Add example for Haskell Stack"
2022-02-22 12:44:25 +05:30
Vipul 669e7536d9 Revert "Add example for Haskell Stack" 2022-02-22 12:17:37 +05:30
Vipul 29dbbce762 Merge pull request #173 from malob/add-stack-example
Add example for Haskell Stack
2022-02-22 12:11:06 +05:30
Malo Bourgon ea5981db97 Add example for Haskell Stack 2022-02-21 14:59:28 -08:00
10 changed files with 54 additions and 126 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: "@actions/cache"
version: 3.1.0
version: 3.0.5
type: npm
summary:
homepage:
-2
View File
@@ -27,8 +27,6 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
* Fixed the download stuck problem by introducing a timeout of 1 hour for cache downloads.
* Fix zstd not working for windows on gnu tar in issues.
* Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MINS`. Default is 60 minutes.
* Two new actions available for granular control over caches - [restore](restore/action.yml) and [save](save/action.yml)
* Add support for cross os caching. For example, a cache saved on windows can be restored on ubuntu and vice versa.
Refer [here](https://github.com/actions/cache/blob/v2/README.md) for previous versions
-8
View File
@@ -52,11 +52,3 @@
### 3.2.0-beta.1
- Added two new actions - [restore](restore/action.yml) and [save](save/action.yml) for granular control on cache.
### 3.2.0
- Released the two new actions - [restore](restore/action.yml) and [save](save/action.yml) for granular control on cache
### 3.2.1
- Update `@actions/cache` on windows to use gnu tar and zstd by default and fallback to bsdtar and zstd if gnu tar is not available. ([issue](https://github.com/actions/cache/issues/984))
- Added support for fallback to gzip to restore old caches on windows.
- Added logs for cache version in case of a cache miss.
+6 -26
View File
@@ -3431,12 +3431,8 @@ function getCacheEntry(keys, paths, options) {
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
// Cache not found
if (response.statusCode === 204) {
// List cache for primary key only if cache miss occurs
if (core.isDebug()) {
yield printCachesListForDiagnostics(keys[0], httpClient, version);
}
// Cache not found
return null;
}
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
@@ -3455,22 +3451,6 @@ function getCacheEntry(keys, paths, options) {
});
}
exports.getCacheEntry = getCacheEntry;
function printCachesListForDiagnostics(key, httpClient, version) {
return __awaiter(this, void 0, void 0, function* () {
const resource = `caches?key=${encodeURIComponent(key)}`;
const response = yield requestUtils_1.retryTypedResponse('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
if (response.statusCode === 200) {
const cacheListResult = response.result;
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
if (totalCount && totalCount > 0) {
core.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);
for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) {
core.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
}
}
}
});
}
function downloadCache(archiveLocation, archivePath, options) {
return __awaiter(this, void 0, void 0, function* () {
const archiveUrl = new url_1.URL(archiveLocation);
@@ -38349,7 +38329,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -d --long=30 --force -o',
'zstd -d --long=30 -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38360,7 +38340,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -d --force -o',
'zstd -d -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38386,7 +38366,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -T0 --long=30 --force -o',
'zstd -T0 --long=30 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -38397,7 +38377,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -T0 --force -o',
'zstd -T0 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -47276,7 +47256,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
return undefined;
}
core.info("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
core.debug("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
}
else {
// Cache not found
+6 -26
View File
@@ -3431,12 +3431,8 @@ function getCacheEntry(keys, paths, options) {
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
// Cache not found
if (response.statusCode === 204) {
// List cache for primary key only if cache miss occurs
if (core.isDebug()) {
yield printCachesListForDiagnostics(keys[0], httpClient, version);
}
// Cache not found
return null;
}
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
@@ -3455,22 +3451,6 @@ function getCacheEntry(keys, paths, options) {
});
}
exports.getCacheEntry = getCacheEntry;
function printCachesListForDiagnostics(key, httpClient, version) {
return __awaiter(this, void 0, void 0, function* () {
const resource = `caches?key=${encodeURIComponent(key)}`;
const response = yield requestUtils_1.retryTypedResponse('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
if (response.statusCode === 200) {
const cacheListResult = response.result;
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
if (totalCount && totalCount > 0) {
core.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);
for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) {
core.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
}
}
}
});
}
function downloadCache(archiveLocation, archivePath, options) {
return __awaiter(this, void 0, void 0, function* () {
const archiveUrl = new url_1.URL(archiveLocation);
@@ -38262,7 +38242,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -d --long=30 --force -o',
'zstd -d --long=30 -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38273,7 +38253,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -d --force -o',
'zstd -d -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38299,7 +38279,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -T0 --long=30 --force -o',
'zstd -T0 --long=30 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -38310,7 +38290,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -T0 --force -o',
'zstd -T0 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -47247,7 +47227,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
return undefined;
}
core.info("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
core.debug("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
}
else {
// Cache not found
+6 -26
View File
@@ -3487,12 +3487,8 @@ function getCacheEntry(keys, paths, options) {
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
// Cache not found
if (response.statusCode === 204) {
// List cache for primary key only if cache miss occurs
if (core.isDebug()) {
yield printCachesListForDiagnostics(keys[0], httpClient, version);
}
// Cache not found
return null;
}
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
@@ -3511,22 +3507,6 @@ function getCacheEntry(keys, paths, options) {
});
}
exports.getCacheEntry = getCacheEntry;
function printCachesListForDiagnostics(key, httpClient, version) {
return __awaiter(this, void 0, void 0, function* () {
const resource = `caches?key=${encodeURIComponent(key)}`;
const response = yield requestUtils_1.retryTypedResponse('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
if (response.statusCode === 200) {
const cacheListResult = response.result;
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
if (totalCount && totalCount > 0) {
core.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);
for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) {
core.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
}
}
}
});
}
function downloadCache(archiveLocation, archivePath, options) {
return __awaiter(this, void 0, void 0, function* () {
const archiveUrl = new url_1.URL(archiveLocation);
@@ -38313,7 +38293,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -d --long=30 --force -o',
'zstd -d --long=30 -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38324,7 +38304,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -d --force -o',
'zstd -d -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38350,7 +38330,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -T0 --long=30 --force -o',
'zstd -T0 --long=30 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -38361,7 +38341,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -T0 --force -o',
'zstd -T0 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -47389,7 +47369,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
return undefined;
}
core.info("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
core.debug("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
}
else {
// Cache not found
+6 -26
View File
@@ -3431,12 +3431,8 @@ function getCacheEntry(keys, paths, options) {
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
const response = yield requestUtils_1.retryTypedResponse('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
// Cache not found
if (response.statusCode === 204) {
// List cache for primary key only if cache miss occurs
if (core.isDebug()) {
yield printCachesListForDiagnostics(keys[0], httpClient, version);
}
// Cache not found
return null;
}
if (!requestUtils_1.isSuccessStatusCode(response.statusCode)) {
@@ -3455,22 +3451,6 @@ function getCacheEntry(keys, paths, options) {
});
}
exports.getCacheEntry = getCacheEntry;
function printCachesListForDiagnostics(key, httpClient, version) {
return __awaiter(this, void 0, void 0, function* () {
const resource = `caches?key=${encodeURIComponent(key)}`;
const response = yield requestUtils_1.retryTypedResponse('listCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
if (response.statusCode === 200) {
const cacheListResult = response.result;
const totalCount = cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.totalCount;
if (totalCount && totalCount > 0) {
core.debug(`No matching cache found for cache key '${key}', version '${version} and scope ${process.env['GITHUB_REF']}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);
for (const cacheEntry of (cacheListResult === null || cacheListResult === void 0 ? void 0 : cacheListResult.artifactCaches) || []) {
core.debug(`Cache Key: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheKey}, Cache Version: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.cacheVersion}, Cache Scope: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.scope}, Cache Created: ${cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.creationTime}`);
}
}
}
});
}
function downloadCache(archiveLocation, archivePath, options) {
return __awaiter(this, void 0, void 0, function* () {
const archiveUrl = new url_1.URL(archiveLocation);
@@ -38257,7 +38237,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -d --long=30 --force -o',
'zstd -d --long=30 -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38268,7 +38248,7 @@ function getDecompressionProgram(tarPath, compressionMethod, archivePath) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -d --force -o',
'zstd -d -o',
constants_1.TarFilename,
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
]
@@ -38294,7 +38274,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.Zstd:
return BSD_TAR_ZSTD
? [
'zstd -T0 --long=30 --force -o',
'zstd -T0 --long=30 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -38305,7 +38285,7 @@ function getCompressionProgram(tarPath, compressionMethod) {
case constants_1.CompressionMethod.ZstdWithoutLong:
return BSD_TAR_ZSTD
? [
'zstd -T0 --force -o',
'zstd -T0 -o',
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
constants_1.TarFilename
]
@@ -47362,7 +47342,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
return undefined;
}
core.info("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
core.debug("Couldn't find cache entry with zstd compression, falling back to gzip compression.");
}
else {
// Cache not found
+9 -9
View File
@@ -1,15 +1,15 @@
{
"name": "cache",
"version": "3.2.1",
"version": "3.2.0-beta.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "cache",
"version": "3.2.1",
"version": "3.2.0-beta.1",
"license": "MIT",
"dependencies": {
"@actions/cache": "^3.1.0",
"@actions/cache": "3.1.0-beta.3",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2"
@@ -36,9 +36,9 @@
}
},
"node_modules/@actions/cache": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.0.tgz",
"integrity": "sha512-wKGJkpK3uFTgwy+KA0fxz0H3/ZPymdi0IlyhMmyoMeWd+CIv8xVPWdGlrPDDdN9bFgve2yvEPZVaKRb43Uwtyg==",
"version": "3.1.0-beta.3",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.0-beta.3.tgz",
"integrity": "sha512-71S1vd0WKLbC2lAe04pCYqTLBjSa8gURtiqnVBCYAt8QVBjOfwa2D3ESf2m8K2xjUxman/Yimdp7CPJDyFnxZg==",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.1",
@@ -9722,9 +9722,9 @@
},
"dependencies": {
"@actions/cache": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.0.tgz",
"integrity": "sha512-wKGJkpK3uFTgwy+KA0fxz0H3/ZPymdi0IlyhMmyoMeWd+CIv8xVPWdGlrPDDdN9bFgve2yvEPZVaKRb43Uwtyg==",
"version": "3.1.0-beta.3",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.0-beta.3.tgz",
"integrity": "sha512-71S1vd0WKLbC2lAe04pCYqTLBjSa8gURtiqnVBCYAt8QVBjOfwa2D3ESf2m8K2xjUxman/Yimdp7CPJDyFnxZg==",
"requires": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.1",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "cache",
"version": "3.2.1",
"version": "3.2.0-beta.1",
"private": true,
"description": "Cache dependencies and build outputs",
"main": "dist/restore/index.js",
@@ -23,7 +23,7 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^3.1.0",
"@actions/cache": "3.1.0-beta.3",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/io": "^1.1.2"
+18
View File
@@ -19,6 +19,24 @@ A cache today is immutable and cannot be updated. But some use cases require the
## Use cache across feature branches
Reusing cache across feature branches is not allowed today to provide cache [isolation](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache). However if both feature branches are from the default branch, a good way to achieve this is to ensure that the default branch has a cache. This cache will then be consumable by both feature branches.
## Improving cache restore performance on Windows/Using cross-os caching
Currently, cache restore is slow on Windows due to tar being inherently slow and the compression algorithm `gzip` in use. `zstd` is the default algorithm in use on linux and macos. It was disabled on Windows due to issues with bsd tar(libarchive), the tar implementation in use on Windows.
To improve cache restore performance, we can re-enable `zstd` as the compression algorithm using the following workaround. Add the following step to your workflow before the cache step:
```yaml
- if: ${{ runner.os == 'Windows' }}
name: Use GNU tar
shell: cmd
run: |
echo "Adding GNU tar to PATH"
echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
```
The `cache` action will use GNU tar instead of bsd tar on Windows. This should work on all Github Hosted runners as it is. For self-hosted runners, please ensure you have GNU tar and `zstd` installed.
The above workaround is also needed if you wish to use cross-os caching since difference of compression algorithms will result in different cache versions for the same cache key. So the above workaround will ensure `zstd` is used for caching on all platforms thus resulting in the same cache version for the same cache key.
## Force deletion of caches overriding default cache eviction policy
Caches have [branch scope restriction](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache) in place. This means that if caches for a specific branch are using a lot of storage quota, it may result into more frequently used caches from `default` branch getting thrashed. For example, if there are many pull requests happening on a repo and are creating caches, these cannot be used in default branch scope but will still occupy a lot of space till they get cleaned up by [eviction policy](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy). But sometime we want to clean them up on a faster cadence so as to ensure default branch is not thrashing. In order to achieve this, [gh-actions-cache cli](https://github.com/actions/gh-actions-cache/) can be used to delete caches for specific branches.