Skip to content

Commit d49b6bb

Browse files
committed
Updated actions/cache toolkit dep to v3.0.4
1 parent a7c34ad commit d49b6bb

7 files changed

Lines changed: 129 additions & 109 deletions

File tree

.licenses/npm/@actions/cache.dep.yml

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ See ["Caching dependencies to speed up workflows"](https://help.github.com/githu
1515
* Updated the minimum runner version support from node 12 -> node 16.
1616
* Fixed avoiding empty cache save when no files are available for caching.
1717
* Fixed tar creation error while trying to create tar with path as `~/` home folder on `ubuntu-latest`.
18-
* Fixed zstd failing on amazon linux 2.0 runners
19-
* Fixed cache not working with github workspace directory or current directory
18+
* Fixed zstd failing on amazon linux 2.0 runners.
19+
* Fixed cache not working with github workspace directory or current directory.
2020
* Fixed the download stuck problem by introducing a timeout of 1 hour for cache downloads.
21+
* Fix zstd not working for windows on gnu tar in issues.
22+
* Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MIN`. Default is 60 minutes.
2123

2224
Refer [here](https://github.com/actions/cache/blob/v2/README.md) for previous versions
2325

@@ -35,6 +37,9 @@ If you are using this inside a container, a POSIX-compliant `tar` needs to be in
3537
* `restore-keys` - An ordered list of keys to use for restoring stale cache if no cache hit occurred for key. Note
3638
`cache-hit` returns false in this case.
3739

40+
#### Environment Variables
41+
* `SEGMENT_DOWNLOAD_TIMEOUT_MIN` - Segment download timeout (in minutes, default `60`) to abort download of the segment if not completed in the defined number of minutes. [Read more](#cache-segment-restore-timeout)
42+
3843
### Outputs
3944

4045
* `cache-hit` - A boolean value to indicate an exact match was found for the key
@@ -218,6 +223,11 @@ jobs:
218223
if: steps.cache-primes.outputs.cache-hit != 'true'
219224
run: ./generate-primes -d prime-numbers
220225
```
226+
## Cache segment restore timeout
227+
228+
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.8` of `actions/cache` 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.
229+
230+
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.
221231

222232
## Contributing
223233
We would love for you to contribute to `actions/cache`, pull requests are welcome! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) for more information.

RELEASES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@
2424
- Fixed [#833](https://github.com/actions/cache/issues/833) - cache doesn't work with github workspace directory
2525

2626
### 3.0.7
27-
- Fixed [#810](https://github.com/actions/cache/issues/810) - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour.
27+
- Fixed [#810](https://github.com/actions/cache/issues/810) - download stuck issue. A new timeout is introduced in the download process to abort the download if it gets stuck and doesn't finish within an hour.
28+
29+
### 3.0.8
30+
- Fix zstd not working for windows on gnu tar in issues [#888](https://github.com/actions/cache/issues/888) and [#891](https://github.com/actions/cache/issues/891).
31+
- Allowing users to provide a custom timeout as input for aborting download of a cache segment using an environment variable `SEGMENT_DOWNLOAD_TIMEOUT_MIN`. Default is 60 minutes.

dist/restore/index.js

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -37240,6 +37240,7 @@ const fs_1 = __webpack_require__(747);
3724037240
const path = __importStar(__webpack_require__(622));
3724137241
const utils = __importStar(__webpack_require__(15));
3724237242
const constants_1 = __webpack_require__(931);
37243+
const IS_WINDOWS = process.platform === 'win32';
3724337244
function getTarPath(args, compressionMethod) {
3724437245
return __awaiter(this, void 0, void 0, function* () {
3724537246
switch (process.platform) {
@@ -37287,26 +37288,43 @@ function getWorkingDirectory() {
3728737288
var _a;
3728837289
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
3728937290
}
37291+
// Common function for extractTar and listTar to get the compression method
37292+
function getCompressionProgram(compressionMethod) {
37293+
// -d: Decompress.
37294+
// unzstd is equivalent to 'zstd -d'
37295+
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
37296+
// Using 30 here because we also support 32-bit self-hosted runners.
37297+
switch (compressionMethod) {
37298+
case constants_1.CompressionMethod.Zstd:
37299+
return [
37300+
'--use-compress-program',
37301+
IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30'
37302+
];
37303+
case constants_1.CompressionMethod.ZstdWithoutLong:
37304+
return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd'];
37305+
default:
37306+
return ['-z'];
37307+
}
37308+
}
37309+
function listTar(archivePath, compressionMethod) {
37310+
return __awaiter(this, void 0, void 0, function* () {
37311+
const args = [
37312+
...getCompressionProgram(compressionMethod),
37313+
'-tf',
37314+
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
37315+
'-P'
37316+
];
37317+
yield execTar(args, compressionMethod);
37318+
});
37319+
}
37320+
exports.listTar = listTar;
3729037321
function extractTar(archivePath, compressionMethod) {
3729137322
return __awaiter(this, void 0, void 0, function* () {
3729237323
// Create directory to extract tar into
3729337324
const workingDirectory = getWorkingDirectory();
3729437325
yield io.mkdirP(workingDirectory);
37295-
// --d: Decompress.
37296-
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
37297-
// Using 30 here because we also support 32-bit self-hosted runners.
37298-
function getCompressionProgram() {
37299-
switch (compressionMethod) {
37300-
case constants_1.CompressionMethod.Zstd:
37301-
return ['--use-compress-program', 'unzstd --long=30'];
37302-
case constants_1.CompressionMethod.ZstdWithoutLong:
37303-
return ['--use-compress-program', 'unzstd'];
37304-
default:
37305-
return ['-z'];
37306-
}
37307-
}
3730837326
const args = [
37309-
...getCompressionProgram(),
37327+
...getCompressionProgram(compressionMethod),
3731037328
'-xf',
3731137329
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
3731237330
'-P',
@@ -37325,15 +37343,19 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
3732537343
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
3732637344
const workingDirectory = getWorkingDirectory();
3732737345
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
37346+
// zstdmt is equivalent to 'zstd -T0'
3732837347
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
3732937348
// Using 30 here because we also support 32-bit self-hosted runners.
3733037349
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
3733137350
function getCompressionProgram() {
3733237351
switch (compressionMethod) {
3733337352
case constants_1.CompressionMethod.Zstd:
37334-
return ['--use-compress-program', 'zstdmt --long=30'];
37353+
return [
37354+
'--use-compress-program',
37355+
IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30'
37356+
];
3733537357
case constants_1.CompressionMethod.ZstdWithoutLong:
37336-
return ['--use-compress-program', 'zstdmt'];
37358+
return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt'];
3733737359
default:
3733837360
return ['-z'];
3733937361
}
@@ -37355,32 +37377,6 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
3735537377
});
3735637378
}
3735737379
exports.createTar = createTar;
37358-
function listTar(archivePath, compressionMethod) {
37359-
return __awaiter(this, void 0, void 0, function* () {
37360-
// --d: Decompress.
37361-
// --long=#: Enables long distance matching with # bits.
37362-
// Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
37363-
// Using 30 here because we also support 32-bit self-hosted runners.
37364-
function getCompressionProgram() {
37365-
switch (compressionMethod) {
37366-
case constants_1.CompressionMethod.Zstd:
37367-
return ['--use-compress-program', 'unzstd --long=30'];
37368-
case constants_1.CompressionMethod.ZstdWithoutLong:
37369-
return ['--use-compress-program', 'unzstd'];
37370-
default:
37371-
return ['-z'];
37372-
}
37373-
}
37374-
const args = [
37375-
...getCompressionProgram(),
37376-
'-tf',
37377-
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
37378-
'-P'
37379-
];
37380-
yield execTar(args, compressionMethod);
37381-
});
37382-
}
37383-
exports.listTar = listTar;
3738437380
//# sourceMappingURL=tar.js.map
3738537381

3738637382
/***/ }),
@@ -40832,9 +40828,16 @@ function getDownloadOptions(copy) {
4083240828
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
4083340829
}
4083440830
}
40831+
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
40832+
if (segmentDownloadTimeoutMins &&
40833+
!isNaN(Number(segmentDownloadTimeoutMins)) &&
40834+
isFinite(Number(segmentDownloadTimeoutMins))) {
40835+
result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 60 * 1000;
40836+
}
4083540837
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
4083640838
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
4083740839
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
40840+
core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
4083840841
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
4083940842
return result;
4084040843
}

dist/save/index.js

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -37240,6 +37240,7 @@ const fs_1 = __webpack_require__(747);
3724037240
const path = __importStar(__webpack_require__(622));
3724137241
const utils = __importStar(__webpack_require__(15));
3724237242
const constants_1 = __webpack_require__(931);
37243+
const IS_WINDOWS = process.platform === 'win32';
3724337244
function getTarPath(args, compressionMethod) {
3724437245
return __awaiter(this, void 0, void 0, function* () {
3724537246
switch (process.platform) {
@@ -37287,26 +37288,43 @@ function getWorkingDirectory() {
3728737288
var _a;
3728837289
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
3728937290
}
37291+
// Common function for extractTar and listTar to get the compression method
37292+
function getCompressionProgram(compressionMethod) {
37293+
// -d: Decompress.
37294+
// unzstd is equivalent to 'zstd -d'
37295+
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
37296+
// Using 30 here because we also support 32-bit self-hosted runners.
37297+
switch (compressionMethod) {
37298+
case constants_1.CompressionMethod.Zstd:
37299+
return [
37300+
'--use-compress-program',
37301+
IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30'
37302+
];
37303+
case constants_1.CompressionMethod.ZstdWithoutLong:
37304+
return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd'];
37305+
default:
37306+
return ['-z'];
37307+
}
37308+
}
37309+
function listTar(archivePath, compressionMethod) {
37310+
return __awaiter(this, void 0, void 0, function* () {
37311+
const args = [
37312+
...getCompressionProgram(compressionMethod),
37313+
'-tf',
37314+
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
37315+
'-P'
37316+
];
37317+
yield execTar(args, compressionMethod);
37318+
});
37319+
}
37320+
exports.listTar = listTar;
3729037321
function extractTar(archivePath, compressionMethod) {
3729137322
return __awaiter(this, void 0, void 0, function* () {
3729237323
// Create directory to extract tar into
3729337324
const workingDirectory = getWorkingDirectory();
3729437325
yield io.mkdirP(workingDirectory);
37295-
// --d: Decompress.
37296-
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
37297-
// Using 30 here because we also support 32-bit self-hosted runners.
37298-
function getCompressionProgram() {
37299-
switch (compressionMethod) {
37300-
case constants_1.CompressionMethod.Zstd:
37301-
return ['--use-compress-program', 'unzstd --long=30'];
37302-
case constants_1.CompressionMethod.ZstdWithoutLong:
37303-
return ['--use-compress-program', 'unzstd'];
37304-
default:
37305-
return ['-z'];
37306-
}
37307-
}
3730837326
const args = [
37309-
...getCompressionProgram(),
37327+
...getCompressionProgram(compressionMethod),
3731037328
'-xf',
3731137329
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
3731237330
'-P',
@@ -37325,15 +37343,19 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
3732537343
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
3732637344
const workingDirectory = getWorkingDirectory();
3732737345
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
37346+
// zstdmt is equivalent to 'zstd -T0'
3732837347
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
3732937348
// Using 30 here because we also support 32-bit self-hosted runners.
3733037349
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
3733137350
function getCompressionProgram() {
3733237351
switch (compressionMethod) {
3733337352
case constants_1.CompressionMethod.Zstd:
37334-
return ['--use-compress-program', 'zstdmt --long=30'];
37353+
return [
37354+
'--use-compress-program',
37355+
IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30'
37356+
];
3733537357
case constants_1.CompressionMethod.ZstdWithoutLong:
37336-
return ['--use-compress-program', 'zstdmt'];
37358+
return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt'];
3733737359
default:
3733837360
return ['-z'];
3733937361
}
@@ -37355,32 +37377,6 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
3735537377
});
3735637378
}
3735737379
exports.createTar = createTar;
37358-
function listTar(archivePath, compressionMethod) {
37359-
return __awaiter(this, void 0, void 0, function* () {
37360-
// --d: Decompress.
37361-
// --long=#: Enables long distance matching with # bits.
37362-
// Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
37363-
// Using 30 here because we also support 32-bit self-hosted runners.
37364-
function getCompressionProgram() {
37365-
switch (compressionMethod) {
37366-
case constants_1.CompressionMethod.Zstd:
37367-
return ['--use-compress-program', 'unzstd --long=30'];
37368-
case constants_1.CompressionMethod.ZstdWithoutLong:
37369-
return ['--use-compress-program', 'unzstd'];
37370-
default:
37371-
return ['-z'];
37372-
}
37373-
}
37374-
const args = [
37375-
...getCompressionProgram(),
37376-
'-tf',
37377-
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
37378-
'-P'
37379-
];
37380-
yield execTar(args, compressionMethod);
37381-
});
37382-
}
37383-
exports.listTar = listTar;
3738437380
//# sourceMappingURL=tar.js.map
3738537381

3738637382
/***/ }),
@@ -40832,9 +40828,16 @@ function getDownloadOptions(copy) {
4083240828
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
4083340829
}
4083440830
}
40831+
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
40832+
if (segmentDownloadTimeoutMins &&
40833+
!isNaN(Number(segmentDownloadTimeoutMins)) &&
40834+
isFinite(Number(segmentDownloadTimeoutMins))) {
40835+
result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 60 * 1000;
40836+
}
4083540837
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
4083640838
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
4083740839
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
40840+
core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
4083840841
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
4083940842
return result;
4084040843
}

0 commit comments

Comments
 (0)