Skip to content

Commit 69d9d44

Browse files
authored
Merge pull request #1118 from actions/pdotl/zstd-hotfix
Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners
2 parents 81b7281 + 8d3a1e0 commit 69d9d44

File tree

9 files changed

+48
-60
lines changed

9 files changed

+48
-60
lines changed

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

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
3131
* New actions are available for granular control over caches - [restore](restore/action.yml) and [save](save/action.yml).
3232
* Support cross-os caching as an opt-in feature. See [Cross OS caching](./tips-and-workarounds.md#cross-os-cache) for more info.
3333
* Added option to fail job on cache miss. See [Exit workflow on cache miss](./restore/README.md#exit-workflow-on-cache-miss) for more info.
34+
* Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners
3435

3536
See the [v2 README.md](https://github.com/actions/cache/blob/v2/README.md) for older updates.
3637

RELEASES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@
7373

7474
### 3.2.5
7575
- Added fix to prevent from setting MYSYS environment variable globally.
76+
77+
### 3.2.6
78+
- Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners.

dist/restore-only/index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,12 +1152,13 @@ function unlinkFile(filePath) {
11521152
});
11531153
}
11541154
exports.unlinkFile = unlinkFile;
1155-
function getVersion(app) {
1155+
function getVersion(app, additionalArgs = []) {
11561156
return __awaiter(this, void 0, void 0, function* () {
1157-
core.debug(`Checking ${app} --version`);
11581157
let versionOutput = '';
1158+
additionalArgs.push('--version');
1159+
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
11591160
try {
1160-
yield exec.exec(`${app} --version`, [], {
1161+
yield exec.exec(`${app}`, additionalArgs, {
11611162
ignoreReturnCode: true,
11621163
silent: true,
11631164
listeners: {
@@ -1177,19 +1178,14 @@ function getVersion(app) {
11771178
// Use zstandard if possible to maximize cache performance
11781179
function getCompressionMethod() {
11791180
return __awaiter(this, void 0, void 0, function* () {
1180-
const versionOutput = yield getVersion('zstd');
1181+
const versionOutput = yield getVersion('zstd', ['--quiet']);
11811182
const version = semver.clean(versionOutput);
1182-
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
1183-
// zstd is not installed
1183+
core.debug(`zstd version: ${version}`);
1184+
if (versionOutput === '') {
11841185
return constants_1.CompressionMethod.Gzip;
11851186
}
1186-
else if (!version || semver.lt(version, 'v1.3.2')) {
1187-
// zstd is installed but using a version earlier than v1.3.2
1188-
// v1.3.2 is required to use the `--long` options in zstd
1189-
return constants_1.CompressionMethod.ZstdWithoutLong;
1190-
}
11911187
else {
1192-
return constants_1.CompressionMethod.Zstd;
1188+
return constants_1.CompressionMethod.ZstdWithoutLong;
11931189
}
11941190
});
11951191
}

dist/restore/index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,12 +1152,13 @@ function unlinkFile(filePath) {
11521152
});
11531153
}
11541154
exports.unlinkFile = unlinkFile;
1155-
function getVersion(app) {
1155+
function getVersion(app, additionalArgs = []) {
11561156
return __awaiter(this, void 0, void 0, function* () {
1157-
core.debug(`Checking ${app} --version`);
11581157
let versionOutput = '';
1158+
additionalArgs.push('--version');
1159+
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
11591160
try {
1160-
yield exec.exec(`${app} --version`, [], {
1161+
yield exec.exec(`${app}`, additionalArgs, {
11611162
ignoreReturnCode: true,
11621163
silent: true,
11631164
listeners: {
@@ -1177,19 +1178,14 @@ function getVersion(app) {
11771178
// Use zstandard if possible to maximize cache performance
11781179
function getCompressionMethod() {
11791180
return __awaiter(this, void 0, void 0, function* () {
1180-
const versionOutput = yield getVersion('zstd');
1181+
const versionOutput = yield getVersion('zstd', ['--quiet']);
11811182
const version = semver.clean(versionOutput);
1182-
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
1183-
// zstd is not installed
1183+
core.debug(`zstd version: ${version}`);
1184+
if (versionOutput === '') {
11841185
return constants_1.CompressionMethod.Gzip;
11851186
}
1186-
else if (!version || semver.lt(version, 'v1.3.2')) {
1187-
// zstd is installed but using a version earlier than v1.3.2
1188-
// v1.3.2 is required to use the `--long` options in zstd
1189-
return constants_1.CompressionMethod.ZstdWithoutLong;
1190-
}
11911187
else {
1192-
return constants_1.CompressionMethod.Zstd;
1188+
return constants_1.CompressionMethod.ZstdWithoutLong;
11931189
}
11941190
});
11951191
}

dist/save-only/index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,12 +1208,13 @@ function unlinkFile(filePath) {
12081208
});
12091209
}
12101210
exports.unlinkFile = unlinkFile;
1211-
function getVersion(app) {
1211+
function getVersion(app, additionalArgs = []) {
12121212
return __awaiter(this, void 0, void 0, function* () {
1213-
core.debug(`Checking ${app} --version`);
12141213
let versionOutput = '';
1214+
additionalArgs.push('--version');
1215+
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
12151216
try {
1216-
yield exec.exec(`${app} --version`, [], {
1217+
yield exec.exec(`${app}`, additionalArgs, {
12171218
ignoreReturnCode: true,
12181219
silent: true,
12191220
listeners: {
@@ -1233,19 +1234,14 @@ function getVersion(app) {
12331234
// Use zstandard if possible to maximize cache performance
12341235
function getCompressionMethod() {
12351236
return __awaiter(this, void 0, void 0, function* () {
1236-
const versionOutput = yield getVersion('zstd');
1237+
const versionOutput = yield getVersion('zstd', ['--quiet']);
12371238
const version = semver.clean(versionOutput);
1238-
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
1239-
// zstd is not installed
1239+
core.debug(`zstd version: ${version}`);
1240+
if (versionOutput === '') {
12401241
return constants_1.CompressionMethod.Gzip;
12411242
}
1242-
else if (!version || semver.lt(version, 'v1.3.2')) {
1243-
// zstd is installed but using a version earlier than v1.3.2
1244-
// v1.3.2 is required to use the `--long` options in zstd
1245-
return constants_1.CompressionMethod.ZstdWithoutLong;
1246-
}
12471243
else {
1248-
return constants_1.CompressionMethod.Zstd;
1244+
return constants_1.CompressionMethod.ZstdWithoutLong;
12491245
}
12501246
});
12511247
}

dist/save/index.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,12 +1152,13 @@ function unlinkFile(filePath) {
11521152
});
11531153
}
11541154
exports.unlinkFile = unlinkFile;
1155-
function getVersion(app) {
1155+
function getVersion(app, additionalArgs = []) {
11561156
return __awaiter(this, void 0, void 0, function* () {
1157-
core.debug(`Checking ${app} --version`);
11581157
let versionOutput = '';
1158+
additionalArgs.push('--version');
1159+
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
11591160
try {
1160-
yield exec.exec(`${app} --version`, [], {
1161+
yield exec.exec(`${app}`, additionalArgs, {
11611162
ignoreReturnCode: true,
11621163
silent: true,
11631164
listeners: {
@@ -1177,19 +1178,14 @@ function getVersion(app) {
11771178
// Use zstandard if possible to maximize cache performance
11781179
function getCompressionMethod() {
11791180
return __awaiter(this, void 0, void 0, function* () {
1180-
const versionOutput = yield getVersion('zstd');
1181+
const versionOutput = yield getVersion('zstd', ['--quiet']);
11811182
const version = semver.clean(versionOutput);
1182-
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
1183-
// zstd is not installed
1183+
core.debug(`zstd version: ${version}`);
1184+
if (versionOutput === '') {
11841185
return constants_1.CompressionMethod.Gzip;
11851186
}
1186-
else if (!version || semver.lt(version, 'v1.3.2')) {
1187-
// zstd is installed but using a version earlier than v1.3.2
1188-
// v1.3.2 is required to use the `--long` options in zstd
1189-
return constants_1.CompressionMethod.ZstdWithoutLong;
1190-
}
11911187
else {
1192-
return constants_1.CompressionMethod.Zstd;
1188+
return constants_1.CompressionMethod.ZstdWithoutLong;
11931189
}
11941190
});
11951191
}

package-lock.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cache",
3-
"version": "3.2.5",
3+
"version": "3.2.6",
44
"private": true,
55
"description": "Cache dependencies and build outputs",
66
"main": "dist/restore/index.js",
@@ -23,7 +23,7 @@
2323
"author": "GitHub",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@actions/cache": "^3.1.3",
26+
"@actions/cache": "^3.1.4",
2727
"@actions/core": "^1.10.0",
2828
"@actions/exec": "^1.1.1",
2929
"@actions/io": "^1.1.2"

0 commit comments

Comments
 (0)