@@ -1070,6 +1070,7 @@ const fs_1 = __nccwpck_require__(7147);
1070
1070
const path = __importStar(__nccwpck_require__(1017));
1071
1071
const utils = __importStar(__nccwpck_require__(1518));
1072
1072
const constants_1 = __nccwpck_require__(8840);
1073
+ const IS_WINDOWS = process.platform === 'win32';
1073
1074
function getTarPath(args, compressionMethod) {
1074
1075
return __awaiter(this, void 0, void 0, function* () {
1075
1076
switch (process.platform) {
@@ -1117,26 +1118,43 @@ function getWorkingDirectory() {
1117
1118
var _a;
1118
1119
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
1119
1120
}
1121
+ // Common function for extractTar and listTar to get the compression method
1122
+ function getCompressionProgram(compressionMethod) {
1123
+ // -d: Decompress.
1124
+ // unzstd is equivalent to 'zstd -d'
1125
+ // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1126
+ // Using 30 here because we also support 32-bit self-hosted runners.
1127
+ switch (compressionMethod) {
1128
+ case constants_1.CompressionMethod.Zstd:
1129
+ return [
1130
+ '--use-compress-program',
1131
+ IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30'
1132
+ ];
1133
+ case constants_1.CompressionMethod.ZstdWithoutLong:
1134
+ return ['--use-compress-program', IS_WINDOWS ? 'zstd -d' : 'unzstd'];
1135
+ default:
1136
+ return ['-z'];
1137
+ }
1138
+ }
1139
+ function listTar(archivePath, compressionMethod) {
1140
+ return __awaiter(this, void 0, void 0, function* () {
1141
+ const args = [
1142
+ ...getCompressionProgram(compressionMethod),
1143
+ '-tf',
1144
+ archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
1145
+ '-P'
1146
+ ];
1147
+ yield execTar(args, compressionMethod);
1148
+ });
1149
+ }
1150
+ exports.listTar = listTar;
1120
1151
function extractTar(archivePath, compressionMethod) {
1121
1152
return __awaiter(this, void 0, void 0, function* () {
1122
1153
// Create directory to extract tar into
1123
1154
const workingDirectory = getWorkingDirectory();
1124
1155
yield io.mkdirP(workingDirectory);
1125
- // --d: Decompress.
1126
- // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1127
- // Using 30 here because we also support 32-bit self-hosted runners.
1128
- function getCompressionProgram() {
1129
- switch (compressionMethod) {
1130
- case constants_1.CompressionMethod.Zstd:
1131
- return ['--use-compress-program', 'unzstd --long=30'];
1132
- case constants_1.CompressionMethod.ZstdWithoutLong:
1133
- return ['--use-compress-program', 'unzstd'];
1134
- default:
1135
- return ['-z'];
1136
- }
1137
- }
1138
1156
const args = [
1139
- ...getCompressionProgram(),
1157
+ ...getCompressionProgram(compressionMethod ),
1140
1158
'-xf',
1141
1159
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
1142
1160
'-P',
@@ -1155,15 +1173,19 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
1155
1173
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
1156
1174
const workingDirectory = getWorkingDirectory();
1157
1175
// -T#: Compress using # working thread. If # is 0, attempt to detect and use the number of physical CPU cores.
1176
+ // zstdmt is equivalent to 'zstd -T0'
1158
1177
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1159
1178
// Using 30 here because we also support 32-bit self-hosted runners.
1160
1179
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
1161
1180
function getCompressionProgram() {
1162
1181
switch (compressionMethod) {
1163
1182
case constants_1.CompressionMethod.Zstd:
1164
- return ['--use-compress-program', 'zstdmt --long=30'];
1183
+ return [
1184
+ '--use-compress-program',
1185
+ IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30'
1186
+ ];
1165
1187
case constants_1.CompressionMethod.ZstdWithoutLong:
1166
- return ['--use-compress-program', 'zstdmt'];
1188
+ return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt'];
1167
1189
default:
1168
1190
return ['-z'];
1169
1191
}
@@ -1185,32 +1207,6 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
1185
1207
});
1186
1208
}
1187
1209
exports.createTar = createTar;
1188
- function listTar(archivePath, compressionMethod) {
1189
- return __awaiter(this, void 0, void 0, function* () {
1190
- // --d: Decompress.
1191
- // --long=#: Enables long distance matching with # bits.
1192
- // Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1193
- // Using 30 here because we also support 32-bit self-hosted runners.
1194
- function getCompressionProgram() {
1195
- switch (compressionMethod) {
1196
- case constants_1.CompressionMethod.Zstd:
1197
- return ['--use-compress-program', 'unzstd --long=30'];
1198
- case constants_1.CompressionMethod.ZstdWithoutLong:
1199
- return ['--use-compress-program', 'unzstd'];
1200
- default:
1201
- return ['-z'];
1202
- }
1203
- }
1204
- const args = [
1205
- ...getCompressionProgram(),
1206
- '-tf',
1207
- archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
1208
- '-P'
1209
- ];
1210
- yield execTar(args, compressionMethod);
1211
- });
1212
- }
1213
- exports.listTar = listTar;
1214
1210
//# sourceMappingURL=tar.js.map
1215
1211
1216
1212
/***/ }),
@@ -1278,9 +1274,16 @@ function getDownloadOptions(copy) {
1278
1274
result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
1279
1275
}
1280
1276
}
1277
+ const segmentDownloadTimeoutMins = process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS'];
1278
+ if (segmentDownloadTimeoutMins &&
1279
+ !isNaN(Number(segmentDownloadTimeoutMins)) &&
1280
+ isFinite(Number(segmentDownloadTimeoutMins))) {
1281
+ result.segmentTimeoutInMs = Number(segmentDownloadTimeoutMins) * 60 * 1000;
1282
+ }
1281
1283
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
1282
1284
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
1283
1285
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
1286
+ core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
1284
1287
core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
1285
1288
return result;
1286
1289
}
0 commit comments