From f2aa430c9d0b572c38be8cfc168a4fd3b0db5cc7 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 10:05:34 +0000 Subject: [PATCH 01/16] Add debug statements --- packages/cache/src/internal/cacheUtils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index ea1e7de6..02a2e98e 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -95,7 +95,9 @@ async function getVersion(app: string): Promise { // Use zstandard if possible to maximize cache performance export async function getCompressionMethod(): Promise { const versionOutput = await getVersion('zstd') + core.debug(`versionOutput: ${versionOutput}`) const version = semver.clean(versionOutput) + core.debug(`version: ${version}`) if (!versionOutput.toLowerCase().includes('zstd command line interface')) { // zstd is not installed From 652109d32c9e7257ff1544a53629e2b0cdb6fb0b Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 10:30:41 +0000 Subject: [PATCH 02/16] Test passing quiet as argument --- packages/cache/src/internal/cacheUtils.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 02a2e98e..e413d10d 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -3,6 +3,7 @@ import * as exec from '@actions/exec' import * as glob from '@actions/glob' import * as io from '@actions/io' import * as fs from 'fs' +import { type } from 'os' import * as path from 'path' import * as semver from 'semver' import * as util from 'util' @@ -71,11 +72,13 @@ export async function unlinkFile(filePath: fs.PathLike): Promise { return util.promisify(fs.unlink)(filePath) } -async function getVersion(app: string): Promise { +async function getVersion(app: string, args?: string[]): Promise { core.debug(`Checking ${app} --version`) let versionOutput = '' + typeof args !== 'undefined' ? args : (args = []) + args.push('--version') try { - await exec.exec(`${app} --version`, [], { + await exec.exec(`${app}`, args, { ignoreReturnCode: true, silent: true, listeners: { @@ -94,7 +97,7 @@ async function getVersion(app: string): Promise { // Use zstandard if possible to maximize cache performance export async function getCompressionMethod(): Promise { - const versionOutput = await getVersion('zstd') + const versionOutput = await getVersion('zstd', ['--quiet']) core.debug(`versionOutput: ${versionOutput}`) const version = semver.clean(versionOutput) core.debug(`version: ${version}`) From c2d3089f8337053c39f7c368d6786a52077ea90b Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 10:32:34 +0000 Subject: [PATCH 03/16] bump version --- packages/cache/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cache/package.json b/packages/cache/package.json index f274e00c..3d5dda6b 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "preview": true, "description": "Actions cache lib", "keywords": [ From 3630ea6eed1c094d7edb197f1603055a92cb0d76 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 12:51:49 +0000 Subject: [PATCH 04/16] Fix bug with version shortcircuiting because of version being null --- packages/cache/src/internal/cacheUtils.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index e413d10d..f9aa379f 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -98,20 +98,13 @@ async function getVersion(app: string, args?: string[]): Promise { // Use zstandard if possible to maximize cache performance export async function getCompressionMethod(): Promise { const versionOutput = await getVersion('zstd', ['--quiet']) - core.debug(`versionOutput: ${versionOutput}`) const version = semver.clean(versionOutput) - core.debug(`version: ${version}`) - - if (!versionOutput.toLowerCase().includes('zstd command line interface')) { - // zstd is not installed - return 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 + if (version) { return CompressionMethod.ZstdWithoutLong } else { - return CompressionMethod.Zstd + return CompressionMethod.Gzip } + } export function getCacheFileName(compressionMethod: CompressionMethod): string { From 9e06993ffc59ffd276dbcc0303827bb64adb7b26 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:08:22 +0000 Subject: [PATCH 05/16] Hotfix zstd version change only --- packages/cache/src/internal/cacheUtils.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index f9aa379f..b767f963 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -99,12 +99,17 @@ async function getVersion(app: string, args?: string[]): Promise { export async function getCompressionMethod(): Promise { const versionOutput = await getVersion('zstd', ['--quiet']) const version = semver.clean(versionOutput) - if (version) { + + if (versionOutput === '') { + // zstd is not installed + return 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 CompressionMethod.ZstdWithoutLong } else { - return CompressionMethod.Gzip + return CompressionMethod.Zstd } - } export function getCacheFileName(compressionMethod: CompressionMethod): string { From 1d1d5456e3c92aeeec8af0404a40baedd7b671d1 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:27:45 +0000 Subject: [PATCH 06/16] Removed code that checks for version less than 1.3.2 as it was not working. Defaulting to zstd without long as that is what is always happening currently. --- packages/cache/src/internal/cacheUtils.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index b767f963..e2580286 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -3,7 +3,6 @@ import * as exec from '@actions/exec' import * as glob from '@actions/glob' import * as io from '@actions/io' import * as fs from 'fs' -import { type } from 'os' import * as path from 'path' import * as semver from 'semver' import * as util from 'util' @@ -100,15 +99,11 @@ export async function getCompressionMethod(): Promise { const versionOutput = await getVersion('zstd', ['--quiet']) const version = semver.clean(versionOutput) - if (versionOutput === '') { + if (versionOutput === '' || version === null) { // zstd is not installed return 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 + } else{ return CompressionMethod.ZstdWithoutLong - } else { - return CompressionMethod.Zstd } } From 83dffb7746ddb42f33770cc8169b86cd25c5e665 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:33:16 +0000 Subject: [PATCH 07/16] Fix lint issues --- packages/cache/src/internal/cacheUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index e2580286..1c4f55c0 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -102,7 +102,7 @@ export async function getCompressionMethod(): Promise { if (versionOutput === '' || version === null) { // zstd is not installed return CompressionMethod.Gzip - } else{ + } else { return CompressionMethod.ZstdWithoutLong } } From 4fd425926c62c6a79c4b3eab3abee280f5b8eb7d Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:43:24 +0000 Subject: [PATCH 08/16] Fix version number --- packages/cache/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cache/package.json b/packages/cache/package.json index 3d5dda6b..f274e00c 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "3.1.4", + "version": "3.1.3", "preview": true, "description": "Actions cache lib", "keywords": [ From e18b2d8a33401c0cdcc032df7eaa28d77ee825e7 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:43:31 +0000 Subject: [PATCH 09/16] 0.0.1 --- package-lock.json | 6 ++++-- package.json | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e12fe8d2..ec7c14ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,8 @@ "prettier": "^1.19.1", "ts-jest": "^27.0.5", "typescript": "^3.9.9" - } + }, + "version": "0.0.1" }, "node_modules/@babel/code-frame": { "version": "7.0.0", @@ -29851,5 +29852,6 @@ "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", "dev": true } - } + }, + "version": "0.0.1" } diff --git a/package.json b/package.json index 235b6d2a..3ad9aeb8 100644 --- a/package.json +++ b/package.json @@ -28,5 +28,6 @@ "prettier": "^1.19.1", "ts-jest": "^27.0.5", "typescript": "^3.9.9" - } + }, + "version": "0.0.1" } From 0f91c9c203215174cac3148f1607d783634538c3 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:44:07 +0000 Subject: [PATCH 10/16] Bump version using npm --- package-lock.json | 6 ++---- package.json | 3 +-- packages/cache/package-lock.json | 4 ++-- packages/cache/package.json | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index ec7c14ad..e12fe8d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,8 +20,7 @@ "prettier": "^1.19.1", "ts-jest": "^27.0.5", "typescript": "^3.9.9" - }, - "version": "0.0.1" + } }, "node_modules/@babel/code-frame": { "version": "7.0.0", @@ -29852,6 +29851,5 @@ "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", "dev": true } - }, - "version": "0.0.1" + } } diff --git a/package.json b/package.json index 3ad9aeb8..235b6d2a 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,5 @@ "prettier": "^1.19.1", "ts-jest": "^27.0.5", "typescript": "^3.9.9" - }, - "version": "0.0.1" + } } diff --git a/packages/cache/package-lock.json b/packages/cache/package-lock.json index f9a20106..408660cb 100644 --- a/packages/cache/package-lock.json +++ b/packages/cache/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", diff --git a/packages/cache/package.json b/packages/cache/package.json index f274e00c..3d5dda6b 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "3.1.3", + "version": "3.1.4", "preview": true, "description": "Actions cache lib", "keywords": [ From 6ec51745adc59fc2b3eb5302f3b56df2f52bfcb0 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 14:23:53 +0000 Subject: [PATCH 11/16] Update debug statement to include latest command --- packages/cache/src/internal/cacheUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 1c4f55c0..0ab64eae 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -72,10 +72,10 @@ export async function unlinkFile(filePath: fs.PathLike): Promise { } async function getVersion(app: string, args?: string[]): Promise { - core.debug(`Checking ${app} --version`) let versionOutput = '' typeof args !== 'undefined' ? args : (args = []) args.push('--version') + core.debug(`Checking ${app} ${args.join(' ')}`) try { await exec.exec(`${app}`, args, { ignoreReturnCode: true, From cf3dd065b8bdc38aa24319052f35499510f0e035 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 14:59:12 +0000 Subject: [PATCH 12/16] Add default value and rename args --- packages/cache/src/internal/cacheUtils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 0ab64eae..8de857f4 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -71,13 +71,12 @@ export async function unlinkFile(filePath: fs.PathLike): Promise { return util.promisify(fs.unlink)(filePath) } -async function getVersion(app: string, args?: string[]): Promise { +async function getVersion(app: string, additionalArgs: string[] = []): Promise { let versionOutput = '' - typeof args !== 'undefined' ? args : (args = []) - args.push('--version') - core.debug(`Checking ${app} ${args.join(' ')}`) + additionalArgs.push('--version') + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`) try { - await exec.exec(`${app}`, args, { + await exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { From a9d266bb7c5a69f6a69f3774d68c19cdad6b06a3 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 15:26:04 +0000 Subject: [PATCH 13/16] Fix lint issues --- packages/cache/src/internal/cacheUtils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 8de857f4..8ccae2f7 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -71,7 +71,10 @@ export async function unlinkFile(filePath: fs.PathLike): Promise { return util.promisify(fs.unlink)(filePath) } -async function getVersion(app: string, additionalArgs: string[] = []): Promise { +async function getVersion( + app: string, + additionalArgs: string[] = [] +): Promise { let versionOutput = '' additionalArgs.push('--version') core.debug(`Checking ${app} ${additionalArgs.join(' ')}`) From bc713ab90db83260febb7830c952039ed85e8e6e Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 18:38:47 +0000 Subject: [PATCH 14/16] Add release info --- packages/cache/RELEASES.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cache/RELEASES.md b/packages/cache/RELEASES.md index b1d52116..76bec600 100644 --- a/packages/cache/RELEASES.md +++ b/packages/cache/RELEASES.md @@ -114,4 +114,7 @@ - Fix issue with symlink restoration on windows. ### 3.1.3 -- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329). \ No newline at end of file +- Fix to prevent from setting MYSYS environement variable globally [#1329](https://github.com/actions/toolkit/pull/1329). + +### 3.1.4 +- Fix zstd not being used due to `zstd --version` output change in zstd 1.5.4 release. See [#1353](https://github.com/actions/toolkit/pull/1353). \ No newline at end of file From 7c15bf6f4020cd866eff61b63b74f798b0128b8f Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 18:50:26 +0000 Subject: [PATCH 15/16] Fix failing windows test --- packages/cache/src/internal/cacheUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 8ccae2f7..ea69b7cc 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -79,7 +79,7 @@ async function getVersion( additionalArgs.push('--version') core.debug(`Checking ${app} ${additionalArgs.join(' ')}`) try { - await exec.exec(`${app}`, additionalArgs, { + await exec.exec(`${app} `, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { From e6e29846f21d19e4a9cd07debd48bb7dfdf85b93 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 19:03:44 +0000 Subject: [PATCH 16/16] Add debug statement for exact zstd version value and remove dependence on version for now --- packages/cache/src/internal/cacheUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index ea69b7cc..650653ad 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -79,7 +79,7 @@ async function getVersion( additionalArgs.push('--version') core.debug(`Checking ${app} ${additionalArgs.join(' ')}`) try { - await exec.exec(`${app} `, additionalArgs, { + await exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: { @@ -100,9 +100,9 @@ async function getVersion( export async function getCompressionMethod(): Promise { const versionOutput = await getVersion('zstd', ['--quiet']) const version = semver.clean(versionOutput) + core.debug(`zstd version: ${version}`) - if (versionOutput === '' || version === null) { - // zstd is not installed + if (versionOutput === '') { return CompressionMethod.Gzip } else { return CompressionMethod.ZstdWithoutLong