From 9e06993ffc59ffd276dbcc0303827bb64adb7b26 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 13:08:22 +0000 Subject: [PATCH] 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 {