mirror of
https://github.com/actions/cache.git
synced 2024-12-26 11:33:05 +07:00
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
This commit is contained in:
commit
69d9d449ac
BIN
.licenses/npm/@actions/cache.dep.yml
generated
BIN
.licenses/npm/@actions/cache.dep.yml
generated
Binary file not shown.
@ -31,6 +31,7 @@ See ["Caching dependencies to speed up workflows"](https://docs.github.com/en/ac
|
|||||||
* New actions are available for granular control over caches - [restore](restore/action.yml) and [save](save/action.yml).
|
* New actions are available for granular control over caches - [restore](restore/action.yml) and [save](save/action.yml).
|
||||||
* Support cross-os caching as an opt-in feature. See [Cross OS caching](./tips-and-workarounds.md#cross-os-cache) for more info.
|
* Support cross-os caching as an opt-in feature. See [Cross OS caching](./tips-and-workarounds.md#cross-os-cache) for more info.
|
||||||
* 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.
|
* 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.
|
||||||
|
* Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners
|
||||||
|
|
||||||
See the [v2 README.md](https://github.com/actions/cache/blob/v2/README.md) for older updates.
|
See the [v2 README.md](https://github.com/actions/cache/blob/v2/README.md) for older updates.
|
||||||
|
|
||||||
|
@ -73,3 +73,6 @@
|
|||||||
|
|
||||||
### 3.2.5
|
### 3.2.5
|
||||||
- Added fix to prevent from setting MYSYS environment variable globally.
|
- Added fix to prevent from setting MYSYS environment variable globally.
|
||||||
|
|
||||||
|
### 3.2.6
|
||||||
|
- Fix zstd not being used after zstd version upgrade to 1.5.4 on hosted runners.
|
||||||
|
20
dist/restore-only/index.js
vendored
20
dist/restore-only/index.js
vendored
@ -1152,12 +1152,13 @@ function unlinkFile(filePath) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.unlinkFile = unlinkFile;
|
exports.unlinkFile = unlinkFile;
|
||||||
function getVersion(app) {
|
function getVersion(app, additionalArgs = []) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.debug(`Checking ${app} --version`);
|
|
||||||
let versionOutput = '';
|
let versionOutput = '';
|
||||||
|
additionalArgs.push('--version');
|
||||||
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`${app} --version`, [], {
|
yield exec.exec(`${app}`, additionalArgs, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@ -1177,19 +1178,14 @@ function getVersion(app) {
|
|||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
function getCompressionMethod() {
|
function getCompressionMethod() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const versionOutput = yield getVersion('zstd');
|
const versionOutput = yield getVersion('zstd', ['--quiet']);
|
||||||
const version = semver.clean(versionOutput);
|
const version = semver.clean(versionOutput);
|
||||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
core.debug(`zstd version: ${version}`);
|
||||||
// zstd is not installed
|
if (versionOutput === '') {
|
||||||
return constants_1.CompressionMethod.Gzip;
|
return constants_1.CompressionMethod.Gzip;
|
||||||
}
|
}
|
||||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
|
||||||
// zstd is installed but using a version earlier than v1.3.2
|
|
||||||
// v1.3.2 is required to use the `--long` options in zstd
|
|
||||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return constants_1.CompressionMethod.Zstd;
|
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
20
dist/restore/index.js
vendored
20
dist/restore/index.js
vendored
@ -1152,12 +1152,13 @@ function unlinkFile(filePath) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.unlinkFile = unlinkFile;
|
exports.unlinkFile = unlinkFile;
|
||||||
function getVersion(app) {
|
function getVersion(app, additionalArgs = []) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.debug(`Checking ${app} --version`);
|
|
||||||
let versionOutput = '';
|
let versionOutput = '';
|
||||||
|
additionalArgs.push('--version');
|
||||||
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`${app} --version`, [], {
|
yield exec.exec(`${app}`, additionalArgs, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@ -1177,19 +1178,14 @@ function getVersion(app) {
|
|||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
function getCompressionMethod() {
|
function getCompressionMethod() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const versionOutput = yield getVersion('zstd');
|
const versionOutput = yield getVersion('zstd', ['--quiet']);
|
||||||
const version = semver.clean(versionOutput);
|
const version = semver.clean(versionOutput);
|
||||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
core.debug(`zstd version: ${version}`);
|
||||||
// zstd is not installed
|
if (versionOutput === '') {
|
||||||
return constants_1.CompressionMethod.Gzip;
|
return constants_1.CompressionMethod.Gzip;
|
||||||
}
|
}
|
||||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
|
||||||
// zstd is installed but using a version earlier than v1.3.2
|
|
||||||
// v1.3.2 is required to use the `--long` options in zstd
|
|
||||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return constants_1.CompressionMethod.Zstd;
|
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
20
dist/save-only/index.js
vendored
20
dist/save-only/index.js
vendored
@ -1208,12 +1208,13 @@ function unlinkFile(filePath) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.unlinkFile = unlinkFile;
|
exports.unlinkFile = unlinkFile;
|
||||||
function getVersion(app) {
|
function getVersion(app, additionalArgs = []) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.debug(`Checking ${app} --version`);
|
|
||||||
let versionOutput = '';
|
let versionOutput = '';
|
||||||
|
additionalArgs.push('--version');
|
||||||
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`${app} --version`, [], {
|
yield exec.exec(`${app}`, additionalArgs, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@ -1233,19 +1234,14 @@ function getVersion(app) {
|
|||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
function getCompressionMethod() {
|
function getCompressionMethod() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const versionOutput = yield getVersion('zstd');
|
const versionOutput = yield getVersion('zstd', ['--quiet']);
|
||||||
const version = semver.clean(versionOutput);
|
const version = semver.clean(versionOutput);
|
||||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
core.debug(`zstd version: ${version}`);
|
||||||
// zstd is not installed
|
if (versionOutput === '') {
|
||||||
return constants_1.CompressionMethod.Gzip;
|
return constants_1.CompressionMethod.Gzip;
|
||||||
}
|
}
|
||||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
|
||||||
// zstd is installed but using a version earlier than v1.3.2
|
|
||||||
// v1.3.2 is required to use the `--long` options in zstd
|
|
||||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return constants_1.CompressionMethod.Zstd;
|
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
20
dist/save/index.js
vendored
20
dist/save/index.js
vendored
@ -1152,12 +1152,13 @@ function unlinkFile(filePath) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.unlinkFile = unlinkFile;
|
exports.unlinkFile = unlinkFile;
|
||||||
function getVersion(app) {
|
function getVersion(app, additionalArgs = []) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.debug(`Checking ${app} --version`);
|
|
||||||
let versionOutput = '';
|
let versionOutput = '';
|
||||||
|
additionalArgs.push('--version');
|
||||||
|
core.debug(`Checking ${app} ${additionalArgs.join(' ')}`);
|
||||||
try {
|
try {
|
||||||
yield exec.exec(`${app} --version`, [], {
|
yield exec.exec(`${app}`, additionalArgs, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
@ -1177,19 +1178,14 @@ function getVersion(app) {
|
|||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
function getCompressionMethod() {
|
function getCompressionMethod() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const versionOutput = yield getVersion('zstd');
|
const versionOutput = yield getVersion('zstd', ['--quiet']);
|
||||||
const version = semver.clean(versionOutput);
|
const version = semver.clean(versionOutput);
|
||||||
if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
|
core.debug(`zstd version: ${version}`);
|
||||||
// zstd is not installed
|
if (versionOutput === '') {
|
||||||
return constants_1.CompressionMethod.Gzip;
|
return constants_1.CompressionMethod.Gzip;
|
||||||
}
|
}
|
||||||
else if (!version || semver.lt(version, 'v1.3.2')) {
|
|
||||||
// zstd is installed but using a version earlier than v1.3.2
|
|
||||||
// v1.3.2 is required to use the `--long` options in zstd
|
|
||||||
return constants_1.CompressionMethod.ZstdWithoutLong;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return constants_1.CompressionMethod.Zstd;
|
return constants_1.CompressionMethod.ZstdWithoutLong;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "3.2.5",
|
"version": "3.2.6",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "3.2.5",
|
"version": "3.2.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.1.3",
|
"@actions/cache": "^3.1.4",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2"
|
"@actions/io": "^1.1.2"
|
||||||
@ -36,9 +36,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.4.tgz",
|
||||||
"integrity": "sha512-5YbATJUS6nVs9EkpK7JaliC3G5koKdJT99NLreL0gJlznudzZzXGNIheW5+HUT9C2DBvubOxYIyfX4v2UpZWrA==",
|
"integrity": "sha512-Uh9wsz7SxunfyqF3UY/wfHI81z97CYQrZs4NU+whzYd0N8emTaloB+XtrAq46X2RbQEOBjF6R090jKQpX4coGg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
@ -9722,9 +9722,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": {
|
"@actions/cache": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.1.4.tgz",
|
||||||
"integrity": "sha512-5YbATJUS6nVs9EkpK7JaliC3G5koKdJT99NLreL0gJlznudzZzXGNIheW5+HUT9C2DBvubOxYIyfX4v2UpZWrA==",
|
"integrity": "sha512-Uh9wsz7SxunfyqF3UY/wfHI81z97CYQrZs4NU+whzYd0N8emTaloB+XtrAq46X2RbQEOBjF6R090jKQpX4coGg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cache",
|
"name": "cache",
|
||||||
"version": "3.2.5",
|
"version": "3.2.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Cache dependencies and build outputs",
|
"description": "Cache dependencies and build outputs",
|
||||||
"main": "dist/restore/index.js",
|
"main": "dist/restore/index.js",
|
||||||
@ -23,7 +23,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^3.1.3",
|
"@actions/cache": "^3.1.4",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2"
|
"@actions/io": "^1.1.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user