mirror of
https://github.com/actions/cache.git
synced 2025-06-24 19:31:10 +02:00
Compare commits
14 Commits
tiwarishub
...
v3.0.7
Author | SHA1 | Date | |
---|---|---|---|
a7c34adf76 | |||
83394c99b7 | |||
e839c25979 | |||
33a923d660 | |||
a404368986 | |||
f4278025ab | |||
9916fe1701 | |||
318935ef66 | |||
85efbb58b9 | |||
4387dbc81a | |||
71e3ee5cce | |||
c316eb7911 | |||
0865c47f36 | |||
a0e530f115 |
1
.github/auto_assign.yml
vendored
1
.github/auto_assign.yml
vendored
@ -6,6 +6,7 @@ addAssignees: false
|
||||
|
||||
# A list of reviewers to be added to pull requests (GitHub user name)
|
||||
reviewers:
|
||||
- phantsure
|
||||
- kotewar
|
||||
- aparna-ravindra
|
||||
- tiwarishub
|
||||
|
2
.github/workflows/auto-assign-issues.yml
vendored
2
.github/workflows/auto-assign-issues.yml
vendored
@ -11,5 +11,5 @@ jobs:
|
||||
- name: 'Auto-assign issue'
|
||||
uses: pozil/auto-assign-issue@v1.4.0
|
||||
with:
|
||||
assignees: kotewar,tiwarishub,aparna-ravindra,vsvipul,bishal-pdmsft
|
||||
assignees: phantsure,kotewar,tiwarishub,aparna-ravindra,vsvipul,bishal-pdmsft
|
||||
numOfAssignee: 1
|
||||
|
2
.licenses/npm/@actions/cache.dep.yml
generated
2
.licenses/npm/@actions/cache.dep.yml
generated
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@actions/cache"
|
||||
version: 3.0.0
|
||||
version: 3.0.3
|
||||
type: npm
|
||||
summary:
|
||||
homepage:
|
||||
|
@ -15,6 +15,9 @@ See ["Caching dependencies to speed up workflows"](https://help.github.com/githu
|
||||
* Updated the minimum runner version support from node 12 -> node 16.
|
||||
* Fixed avoiding empty cache save when no files are available for caching.
|
||||
* Fixed tar creation error while trying to create tar with path as `~/` home folder on `ubuntu-latest`.
|
||||
* Fixed zstd failing on amazon linux 2.0 runners
|
||||
* Fixed cache not working with github workspace directory or current directory
|
||||
* Fixed the download stuck problem by introducing a timeout of 1 hour for cache downloads.
|
||||
|
||||
Refer [here](https://github.com/actions/cache/blob/v2/README.md) for previous versions
|
||||
|
||||
@ -81,6 +84,7 @@ Every programming language and framework has its own way of caching.
|
||||
See [Examples](examples.md) for a list of `actions/cache` implementations for use with:
|
||||
|
||||
- [C# - NuGet](./examples.md#c---nuget)
|
||||
- [Clojure - Lein Deps](./examples.md#clojure---lein-deps)
|
||||
- [D - DUB](./examples.md#d---dub)
|
||||
- [Deno](./examples.md#deno)
|
||||
- [Elixir - Mix](./examples.md#elixir---mix)
|
||||
|
12
RELEASES.md
12
RELEASES.md
@ -14,4 +14,14 @@
|
||||
- Fixed avoiding empty cache save when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624))
|
||||
|
||||
### 3.0.4
|
||||
- Fixed tar creation error while trying to create tar with path as `~/` home folder on `ubuntu-latest`. ([issue](https://github.com/actions/cache/issues/689))
|
||||
- Fixed tar creation error while trying to create tar with path as `~/` home folder on `ubuntu-latest`. ([issue](https://github.com/actions/cache/issues/689))
|
||||
|
||||
### 3.0.5
|
||||
- Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit. ([PR](https://github.com/actions/cache/pull/834))
|
||||
|
||||
### 3.0.6
|
||||
- Fixed [#809](https://github.com/actions/cache/issues/809) - zstd -d: no such file or directory error
|
||||
- Fixed [#833](https://github.com/actions/cache/issues/833) - cache doesn't work with github workspace directory
|
||||
|
||||
### 3.0.7
|
||||
- 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.
|
53
dist/restore/index.js
vendored
53
dist/restore/index.js
vendored
@ -1113,7 +1113,13 @@ function resolvePaths(patterns) {
|
||||
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
||||
core.debug(`Matched: ${relativeFile}`);
|
||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||
paths.push(`${relativeFile}`);
|
||||
if (relativeFile === '') {
|
||||
// path.relative returns empty string if workspace and file are equal
|
||||
paths.push('.');
|
||||
}
|
||||
else {
|
||||
paths.push(`${relativeFile}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
@ -5467,6 +5473,7 @@ const util = __importStar(__webpack_require__(669));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
const abort_controller_1 = __webpack_require__(106);
|
||||
/**
|
||||
* Pipes the body of a HTTP response to a stream
|
||||
*
|
||||
@ -5650,15 +5657,24 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
const fd = fs.openSync(archivePath, 'w');
|
||||
try {
|
||||
downloadProgress.startDisplayTimer();
|
||||
const controller = new abort_controller_1.AbortController();
|
||||
const abortSignal = controller.signal;
|
||||
while (!downloadProgress.isDone()) {
|
||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||
downloadProgress.nextSegment(segmentSize);
|
||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
const result = yield promiseWithTimeout(options.segmentTimeoutInMs || 3600000, client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
abortSignal,
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
});
|
||||
fs.writeFileSync(fd, result);
|
||||
}));
|
||||
if (result === 'timeout') {
|
||||
controller.abort();
|
||||
throw new Error('Aborting cache download as the download time exceeded the timeout.');
|
||||
}
|
||||
else if (Buffer.isBuffer(result)) {
|
||||
fs.writeFileSync(fd, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@ -5669,6 +5685,16 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
});
|
||||
}
|
||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
|
||||
const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
let timeoutHandle;
|
||||
const timeoutPromise = new Promise(resolve => {
|
||||
timeoutHandle = setTimeout(() => resolve('timeout'), timeoutMs);
|
||||
});
|
||||
return Promise.race([promise, timeoutPromise]).then(result => {
|
||||
clearTimeout(timeoutHandle);
|
||||
return result;
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=downloadUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -37272,9 +37298,9 @@ function extractTar(archivePath, compressionMethod) {
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
return ['--use-compress-program', 'unzstd --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
return ['--use-compress-program', 'unzstd'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
@ -37305,9 +37331,9 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
||||
return ['--use-compress-program', 'zstdmt --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -T0'];
|
||||
return ['--use-compress-program', 'zstdmt'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
@ -37338,9 +37364,9 @@ function listTar(archivePath, compressionMethod) {
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
return ['--use-compress-program', 'unzstd --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
return ['--use-compress-program', 'unzstd'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
@ -40789,7 +40815,8 @@ function getDownloadOptions(copy) {
|
||||
const result = {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
@ -40801,10 +40828,14 @@ function getDownloadOptions(copy) {
|
||||
if (typeof copy.timeoutInMs === 'number') {
|
||||
result.timeoutInMs = copy.timeoutInMs;
|
||||
}
|
||||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
|
||||
}
|
||||
}
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
|
||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
|
||||
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
53
dist/save/index.js
vendored
53
dist/save/index.js
vendored
@ -1113,7 +1113,13 @@ function resolvePaths(patterns) {
|
||||
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
|
||||
core.debug(`Matched: ${relativeFile}`);
|
||||
// Paths are made relative so the tar entries are all relative to the root of the workspace.
|
||||
paths.push(`${relativeFile}`);
|
||||
if (relativeFile === '') {
|
||||
// path.relative returns empty string if workspace and file are equal
|
||||
paths.push('.');
|
||||
}
|
||||
else {
|
||||
paths.push(`${relativeFile}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
@ -5467,6 +5473,7 @@ const util = __importStar(__webpack_require__(669));
|
||||
const utils = __importStar(__webpack_require__(15));
|
||||
const constants_1 = __webpack_require__(931);
|
||||
const requestUtils_1 = __webpack_require__(899);
|
||||
const abort_controller_1 = __webpack_require__(106);
|
||||
/**
|
||||
* Pipes the body of a HTTP response to a stream
|
||||
*
|
||||
@ -5650,15 +5657,24 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
const fd = fs.openSync(archivePath, 'w');
|
||||
try {
|
||||
downloadProgress.startDisplayTimer();
|
||||
const controller = new abort_controller_1.AbortController();
|
||||
const abortSignal = controller.signal;
|
||||
while (!downloadProgress.isDone()) {
|
||||
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
|
||||
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
|
||||
downloadProgress.nextSegment(segmentSize);
|
||||
const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
const result = yield promiseWithTimeout(options.segmentTimeoutInMs || 3600000, client.downloadToBuffer(segmentStart, segmentSize, {
|
||||
abortSignal,
|
||||
concurrency: options.downloadConcurrency,
|
||||
onProgress: downloadProgress.onProgress()
|
||||
});
|
||||
fs.writeFileSync(fd, result);
|
||||
}));
|
||||
if (result === 'timeout') {
|
||||
controller.abort();
|
||||
throw new Error('Aborting cache download as the download time exceeded the timeout.');
|
||||
}
|
||||
else if (Buffer.isBuffer(result)) {
|
||||
fs.writeFileSync(fd, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@ -5669,6 +5685,16 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
||||
});
|
||||
}
|
||||
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
|
||||
const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
let timeoutHandle;
|
||||
const timeoutPromise = new Promise(resolve => {
|
||||
timeoutHandle = setTimeout(() => resolve('timeout'), timeoutMs);
|
||||
});
|
||||
return Promise.race([promise, timeoutPromise]).then(result => {
|
||||
clearTimeout(timeoutHandle);
|
||||
return result;
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=downloadUtils.js.map
|
||||
|
||||
/***/ }),
|
||||
@ -37272,9 +37298,9 @@ function extractTar(archivePath, compressionMethod) {
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
return ['--use-compress-program', 'unzstd --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
return ['--use-compress-program', 'unzstd'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
@ -37305,9 +37331,9 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -T0 --long=30'];
|
||||
return ['--use-compress-program', 'zstdmt --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -T0'];
|
||||
return ['--use-compress-program', 'zstdmt'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
@ -37338,9 +37364,9 @@ function listTar(archivePath, compressionMethod) {
|
||||
function getCompressionProgram() {
|
||||
switch (compressionMethod) {
|
||||
case constants_1.CompressionMethod.Zstd:
|
||||
return ['--use-compress-program', 'zstd -d --long=30'];
|
||||
return ['--use-compress-program', 'unzstd --long=30'];
|
||||
case constants_1.CompressionMethod.ZstdWithoutLong:
|
||||
return ['--use-compress-program', 'zstd -d'];
|
||||
return ['--use-compress-program', 'unzstd'];
|
||||
default:
|
||||
return ['-z'];
|
||||
}
|
||||
@ -40789,7 +40815,8 @@ function getDownloadOptions(copy) {
|
||||
const result = {
|
||||
useAzureSdk: true,
|
||||
downloadConcurrency: 8,
|
||||
timeoutInMs: 30000
|
||||
timeoutInMs: 30000,
|
||||
segmentTimeoutInMs: 3600000
|
||||
};
|
||||
if (copy) {
|
||||
if (typeof copy.useAzureSdk === 'boolean') {
|
||||
@ -40801,10 +40828,14 @@ function getDownloadOptions(copy) {
|
||||
if (typeof copy.timeoutInMs === 'number') {
|
||||
result.timeoutInMs = copy.timeoutInMs;
|
||||
}
|
||||
if (typeof copy.segmentTimeoutInMs === 'number') {
|
||||
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
|
||||
}
|
||||
}
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
|
||||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
|
||||
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
|
||||
return result;
|
||||
}
|
||||
exports.getDownloadOptions = getDownloadOptions;
|
||||
|
14
examples.md
14
examples.md
@ -1,6 +1,7 @@
|
||||
# Examples
|
||||
|
||||
- [C# - NuGet](#c---nuget)
|
||||
- [Clojure - Lein Deps](#clojure---lein-deps)
|
||||
- [D - DUB](#d---dub)
|
||||
- [POSIX](#posix)
|
||||
- [Windows](#windows)
|
||||
@ -80,6 +81,19 @@ steps:
|
||||
${{ runner.os }}-nuget-
|
||||
```
|
||||
|
||||
## Clojure - Lein Deps
|
||||
|
||||
```yaml
|
||||
- name: Cache lein project dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-clojure-${{ hashFiles('**/project.clj') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-clojure
|
||||
```
|
||||
|
||||
|
||||
## D - DUB
|
||||
|
||||
### POSIX
|
||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "cache",
|
||||
"version": "3.0.4",
|
||||
"version": "3.0.7",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cache",
|
||||
"version": "3.0.4",
|
||||
"version": "3.0.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.0.0",
|
||||
"@actions/cache": "^3.0.3",
|
||||
"@actions/core": "^1.7.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2"
|
||||
@ -36,9 +36,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/cache": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
|
||||
"integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.3.tgz",
|
||||
"integrity": "sha512-kn0pZRQNFRg1IQnW/N7uTNbbLqYalvQW2bmrznn3C34LMY/rSuEmH6Uo69HDh335Q0vKs9kg/jsIarzUBKzEXg==",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.1",
|
||||
@ -9533,9 +9533,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
|
||||
"integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.3.tgz",
|
||||
"integrity": "sha512-kn0pZRQNFRg1IQnW/N7uTNbbLqYalvQW2bmrznn3C34LMY/rSuEmH6Uo69HDh335Q0vKs9kg/jsIarzUBKzEXg==",
|
||||
"requires": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cache",
|
||||
"version": "3.0.4",
|
||||
"version": "3.0.7",
|
||||
"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.0.0",
|
||||
"@actions/cache": "^3.0.3",
|
||||
"@actions/core": "^1.7.0",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/io": "^1.1.2"
|
||||
|
Reference in New Issue
Block a user