@actions/cache
Advanced tools
Comparing version 3.0.3 to 3.0.4
import { CompressionMethod } from './constants'; | ||
export declare function listTar(archivePath: string, compressionMethod: CompressionMethod): Promise<void>; | ||
export declare function extractTar(archivePath: string, compressionMethod: CompressionMethod): Promise<void>; | ||
export declare function createTar(archiveFolder: string, sourceDirectories: string[], compressionMethod: CompressionMethod): Promise<void>; | ||
export declare function listTar(archivePath: string, compressionMethod: CompressionMethod): Promise<void>; |
@@ -25,2 +25,3 @@ "use strict"; | ||
const constants_1 = require("./constants"); | ||
const IS_WINDOWS = process.platform === 'win32'; | ||
function getTarPath(args, compressionMethod) { | ||
@@ -73,2 +74,32 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
// Common function for extractTar and listTar to get the compression method | ||
function getCompressionProgram(compressionMethod) { | ||
// -d: Decompress. | ||
// unzstd is equivalent to 'zstd -d' | ||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. | ||
// Using 30 here because we also support 32-bit self-hosted runners. | ||
switch (compressionMethod) { | ||
case constants_1.CompressionMethod.Zstd: | ||
return [ | ||
'--use-compress-program', | ||
IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30' | ||
]; | ||
case constants_1.CompressionMethod.ZstdWithoutLong: | ||
return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd']; | ||
default: | ||
return ['-z']; | ||
} | ||
} | ||
function listTar(archivePath, compressionMethod) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const args = [ | ||
...getCompressionProgram(compressionMethod), | ||
'-tf', | ||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), | ||
'-P' | ||
]; | ||
yield execTar(args, compressionMethod); | ||
}); | ||
} | ||
exports.listTar = listTar; | ||
function extractTar(archivePath, compressionMethod) { | ||
@@ -79,17 +110,4 @@ return __awaiter(this, void 0, void 0, function* () { | ||
yield io.mkdirP(workingDirectory); | ||
// --d: Decompress. | ||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. | ||
// Using 30 here because we also support 32-bit self-hosted runners. | ||
function getCompressionProgram() { | ||
switch (compressionMethod) { | ||
case constants_1.CompressionMethod.Zstd: | ||
return ['--use-compress-program', 'unzstd --long=30']; | ||
case constants_1.CompressionMethod.ZstdWithoutLong: | ||
return ['--use-compress-program', 'unzstd']; | ||
default: | ||
return ['-z']; | ||
} | ||
} | ||
const args = [ | ||
...getCompressionProgram(), | ||
...getCompressionProgram(compressionMethod), | ||
'-xf', | ||
@@ -113,2 +131,3 @@ archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), | ||
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores. | ||
// zstdmt is equivalent to 'zstd -T0' | ||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. | ||
@@ -120,5 +139,8 @@ // Using 30 here because we also support 32-bit self-hosted runners. | ||
case constants_1.CompressionMethod.Zstd: | ||
return ['--use-compress-program', 'zstdmt --long=30']; | ||
return [ | ||
'--use-compress-program', | ||
IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30' | ||
]; | ||
case constants_1.CompressionMethod.ZstdWithoutLong: | ||
return ['--use-compress-program', 'zstdmt']; | ||
return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt']; | ||
default: | ||
@@ -145,28 +167,2 @@ return ['-z']; | ||
exports.createTar = createTar; | ||
function listTar(archivePath, compressionMethod) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// --d: Decompress. | ||
// --long=#: Enables long distance matching with # bits. | ||
// Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. | ||
// Using 30 here because we also support 32-bit self-hosted runners. | ||
function getCompressionProgram() { | ||
switch (compressionMethod) { | ||
case constants_1.CompressionMethod.Zstd: | ||
return ['--use-compress-program', 'unzstd --long=30']; | ||
case constants_1.CompressionMethod.ZstdWithoutLong: | ||
return ['--use-compress-program', 'unzstd']; | ||
default: | ||
return ['-z']; | ||
} | ||
} | ||
const args = [ | ||
...getCompressionProgram(), | ||
'-tf', | ||
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), | ||
'-P' | ||
]; | ||
yield execTar(args, compressionMethod); | ||
}); | ||
} | ||
exports.listTar = listTar; | ||
//# sourceMappingURL=tar.js.map |
@@ -60,5 +60,12 @@ "use strict"; | ||
} | ||
const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']; | ||
if (segmentDownloadTimeoutMins && | ||
!isNaN(Number(segmentDownloadTimeoutMins)) && | ||
isFinite(Number(segmentDownloadTimeoutMins))) { | ||
result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 60 * 1000; | ||
} | ||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`); | ||
core.debug(`Download concurrency: ${result.downloadConcurrency}`); | ||
core.debug(`Request timeout (ms): ${result.timeoutInMs}`); | ||
core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`); | ||
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`); | ||
@@ -65,0 +72,0 @@ return result; |
{ | ||
"name": "@actions/cache", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"preview": true, | ||
@@ -5,0 +5,0 @@ "description": "Actions cache lib", |
@@ -45,1 +45,6 @@ # `@actions/cache` | ||
##### Cache segment restore timeout | ||
A cache gets downloaded in multiple segments of fixed sizes (`1GB` for a `32-bit` runner and `2GB` for a `64-bit` runner). Sometimes, a segment download gets stuck which causes the workflow job to be stuck forever and fail. Version `v3.0.4` of cache package introduces a segment download timeout. The segment download timeout will allow the segment download to get aborted and hence allow the job to proceed with a cache miss. | ||
Default value of this timeout is 60 minutes and can be customized by specifying an [environment variable](https://docs.github.com/en/actions/learn-github-actions/environment-variables) named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with timeout value in minutes. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99135
1440
49
15