@@ -525,13 +525,7 @@ function resolvePaths(patterns) {
525
525
.replace(new RegExp(`\\${path.sep}`, 'g'), '/');
526
526
core.debug(`Matched: ${relativeFile}`);
527
527
// Paths are made relative so the tar entries are all relative to the root of the workspace.
528
- if (relativeFile === '') {
529
- // path.relative returns empty string if workspace and file are equal
530
- paths.push('.');
531
- }
532
- else {
533
- paths.push(`${relativeFile}`);
534
- }
528
+ paths.push(`${relativeFile}`);
535
529
}
536
530
}
537
531
catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -689,7 +683,6 @@ const util = __importStar(__nccwpck_require__(3837));
689
683
const utils = __importStar(__nccwpck_require__(1518));
690
684
const constants_1 = __nccwpck_require__(8840);
691
685
const requestUtils_1 = __nccwpck_require__(3981);
692
- const abort_controller_1 = __nccwpck_require__(2557);
693
686
/**
694
687
* Pipes the body of a HTTP response to a stream
695
688
*
@@ -873,24 +866,15 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
873
866
const fd = fs.openSync(archivePath, 'w');
874
867
try {
875
868
downloadProgress.startDisplayTimer();
876
- const controller = new abort_controller_1.AbortController();
877
- const abortSignal = controller.signal;
878
869
while (!downloadProgress.isDone()) {
879
870
const segmentStart = downloadProgress.segmentOffset + downloadProgress.segmentSize;
880
871
const segmentSize = Math.min(maxSegmentSize, contentLength - segmentStart);
881
872
downloadProgress.nextSegment(segmentSize);
882
- const result = yield promiseWithTimeout(options.segmentTimeoutInMs || 3600000, client.downloadToBuffer(segmentStart, segmentSize, {
883
- abortSignal,
873
+ const result = yield client.downloadToBuffer(segmentStart, segmentSize, {
884
874
concurrency: options.downloadConcurrency,
885
875
onProgress: downloadProgress.onProgress()
886
- }));
887
- if (result === 'timeout') {
888
- controller.abort();
889
- throw new Error('Aborting cache download as the download time exceeded the timeout.');
890
- }
891
- else if (Buffer.isBuffer(result)) {
892
- fs.writeFileSync(fd, result);
893
- }
876
+ });
877
+ fs.writeFileSync(fd, result);
894
878
}
895
879
}
896
880
finally {
@@ -901,16 +885,6 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
901
885
});
902
886
}
903
887
exports.downloadCacheStorageSDK = downloadCacheStorageSDK;
904
- const promiseWithTimeout = (timeoutMs, promise) => __awaiter(void 0, void 0, void 0, function* () {
905
- let timeoutHandle;
906
- const timeoutPromise = new Promise(resolve => {
907
- timeoutHandle = setTimeout(() => resolve('timeout'), timeoutMs);
908
- });
909
- return Promise.race([promise, timeoutPromise]).then(result => {
910
- clearTimeout(timeoutHandle);
911
- return result;
912
- });
913
- });
914
888
//# sourceMappingURL=downloadUtils.js.map
915
889
916
890
/***/ }),
@@ -1070,7 +1044,6 @@ const fs_1 = __nccwpck_require__(7147);
1070
1044
const path = __importStar(__nccwpck_require__(1017));
1071
1045
const utils = __importStar(__nccwpck_require__(1518));
1072
1046
const constants_1 = __nccwpck_require__(8840);
1073
- const IS_WINDOWS = process.platform === 'win32';
1074
1047
function getTarPath(args, compressionMethod) {
1075
1048
return __awaiter(this, void 0, void 0, function* () {
1076
1049
switch (process.platform) {
@@ -1118,43 +1091,26 @@ function getWorkingDirectory() {
1118
1091
var _a;
1119
1092
return (_a = process.env['GITHUB_WORKSPACE']) !== null && _a !== void 0 ? _a : process.cwd();
1120
1093
}
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;
1151
1094
function extractTar(archivePath, compressionMethod) {
1152
1095
return __awaiter(this, void 0, void 0, function* () {
1153
1096
// Create directory to extract tar into
1154
1097
const workingDirectory = getWorkingDirectory();
1155
1098
yield io.mkdirP(workingDirectory);
1099
+ // --d: Decompress.
1100
+ // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1101
+ // Using 30 here because we also support 32-bit self-hosted runners.
1102
+ function getCompressionProgram() {
1103
+ switch (compressionMethod) {
1104
+ case constants_1.CompressionMethod.Zstd:
1105
+ return ['--use-compress-program', 'zstd -d --long=30'];
1106
+ case constants_1.CompressionMethod.ZstdWithoutLong:
1107
+ return ['--use-compress-program', 'zstd -d'];
1108
+ default:
1109
+ return ['-z'];
1110
+ }
1111
+ }
1156
1112
const args = [
1157
- ...getCompressionProgram(compressionMethod ),
1113
+ ...getCompressionProgram(),
1158
1114
'-xf',
1159
1115
archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
1160
1116
'-P',
@@ -1173,19 +1129,15 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
1173
1129
fs_1.writeFileSync(path.join(archiveFolder, manifestFilename), sourceDirectories.join('\n'));
1174
1130
const workingDirectory = getWorkingDirectory();
1175
1131
// -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'
1177
1132
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1178
1133
// Using 30 here because we also support 32-bit self-hosted runners.
1179
1134
// Long range mode is added to zstd in v1.3.2 release, so we will not use --long in older version of zstd.
1180
1135
function getCompressionProgram() {
1181
1136
switch (compressionMethod) {
1182
1137
case constants_1.CompressionMethod.Zstd:
1183
- return [
1184
- '--use-compress-program',
1185
- IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30'
1186
- ];
1138
+ return ['--use-compress-program', 'zstd -T0 --long=30'];
1187
1139
case constants_1.CompressionMethod.ZstdWithoutLong:
1188
- return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt '];
1140
+ return ['--use-compress-program', 'zstd -T0'];
1189
1141
default:
1190
1142
return ['-z'];
1191
1143
}
@@ -1207,6 +1159,32 @@ function createTar(archiveFolder, sourceDirectories, compressionMethod) {
1207
1159
});
1208
1160
}
1209
1161
exports.createTar = createTar;
1162
+ function listTar(archivePath, compressionMethod) {
1163
+ return __awaiter(this, void 0, void 0, function* () {
1164
+ // --d: Decompress.
1165
+ // --long=#: Enables long distance matching with # bits.
1166
+ // Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
1167
+ // Using 30 here because we also support 32-bit self-hosted runners.
1168
+ function getCompressionProgram() {
1169
+ switch (compressionMethod) {
1170
+ case constants_1.CompressionMethod.Zstd:
1171
+ return ['--use-compress-program', 'zstd -d --long=30'];
1172
+ case constants_1.CompressionMethod.ZstdWithoutLong:
1173
+ return ['--use-compress-program', 'zstd -d'];
1174
+ default:
1175
+ return ['-z'];
1176
+ }
1177
+ }
1178
+ const args = [
1179
+ ...getCompressionProgram(),
1180
+ '-tf',
1181
+ archivePath.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
1182
+ '-P'
1183
+ ];
1184
+ yield execTar(args, compressionMethod);
1185
+ });
1186
+ }
1187
+ exports.listTar = listTar;
1210
1188
//# sourceMappingURL=tar.js.map
1211
1189
1212
1190
/***/ }),
@@ -1257,8 +1235,7 @@ function getDownloadOptions(copy) {
1257
1235
const result = {
1258
1236
useAzureSdk: true,
1259
1237
downloadConcurrency: 8,
1260
- timeoutInMs: 30000,
1261
- segmentTimeoutInMs: 3600000
1238
+ timeoutInMs: 30000
1262
1239
};
1263
1240
if (copy) {
1264
1241
if (typeof copy.useAzureSdk === 'boolean') {
@@ -1270,21 +1247,10 @@ function getDownloadOptions(copy) {
1270
1247
if (typeof copy.timeoutInMs === 'number') {
1271
1248
result.timeoutInMs = copy.timeoutInMs;
1272
1249
}
1273
- if (typeof copy.segmentTimeoutInMs === 'number') {
1274
- result.segmentTimeoutInMs = copy.segmentTimeoutInMs;
1275
- }
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
1250
}
1283
1251
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
1284
1252
core.debug(`Download concurrency: ${result.downloadConcurrency}`);
1285
1253
core.debug(`Request timeout (ms): ${result.timeoutInMs}`);
1286
- core.debug(`Cache segment download timeout mins env var: ${process.env['SEGMENT_DOWNLOAD_TIMEOUT_MINS']}`);
1287
- core.debug(`Segment download timeout (ms): ${result.segmentTimeoutInMs}`);
1288
1254
return result;
1289
1255
}
1290
1256
exports.getDownloadOptions = getDownloadOptions;
@@ -4865,6 +4831,7 @@ const file_command_1 = __nccwpck_require__(717);
4865
4831
const utils_1 = __nccwpck_require__(5278);
4866
4832
const os = __importStar(__nccwpck_require__(2037));
4867
4833
const path = __importStar(__nccwpck_require__(1017));
4834
+ const uuid_1 = __nccwpck_require__(8974);
4868
4835
const oidc_utils_1 = __nccwpck_require__(8041);
4869
4836
/**
4870
4837
* The code to exit an action
@@ -4894,9 +4861,20 @@ function exportVariable(name, val) {
4894
4861
process.env[name] = convertedVal;
4895
4862
const filePath = process.env['GITHUB_ENV'] || '';
4896
4863
if (filePath) {
4897
- return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
4864
+ const delimiter = `ghadelimiter_${uuid_1.v4()}`;
4865
+ // These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
4866
+ if (name.includes(delimiter)) {
4867
+ throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
4868
+ }
4869
+ if (convertedVal.includes(delimiter)) {
4870
+ throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
4871
+ }
4872
+ const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
4873
+ file_command_1.issueCommand('ENV', commandValue);
4874
+ }
4875
+ else {
4876
+ command_1.issueCommand('set-env', { name }, convertedVal);
4898
4877
}
4899
- command_1.issueCommand('set-env', { name }, convertedVal);
4900
4878
}
4901
4879
exports.exportVariable = exportVariable;
4902
4880
/**
@@ -4914,7 +4892,7 @@ exports.setSecret = setSecret;
4914
4892
function addPath(inputPath) {
4915
4893
const filePath = process.env['GITHUB_PATH'] || '';
4916
4894
if (filePath) {
4917
- file_command_1.issueFileCommand ('PATH', inputPath);
4895
+ file_command_1.issueCommand ('PATH', inputPath);
4918
4896
}
4919
4897
else {
4920
4898
command_1.issueCommand('add-path', {}, inputPath);
@@ -4954,10 +4932,7 @@ function getMultilineInput(name, options) {
4954
4932
const inputs = getInput(name, options)
4955
4933
.split('\n')
4956
4934
.filter(x => x !== '');
4957
- if (options && options.trimWhitespace === false) {
4958
- return inputs;
4959
- }
4960
- return inputs.map(input => input.trim());
4935
+ return inputs;
4961
4936
}
4962
4937
exports.getMultilineInput = getMultilineInput;
4963
4938
/**
@@ -4990,12 +4965,8 @@ exports.getBooleanInput = getBooleanInput;
4990
4965
*/
4991
4966
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4992
4967
function setOutput(name, value) {
4993
- const filePath = process.env['GITHUB_OUTPUT'] || '';
4994
- if (filePath) {
4995
- return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
4996
- }
4997
4968
process.stdout.write(os.EOL);
4998
- command_1.issueCommand('set-output', { name }, utils_1.toCommandValue( value) );
4969
+ command_1.issueCommand('set-output', { name }, value);
4999
4970
}
5000
4971
exports.setOutput = setOutput;
5001
4972
/**
@@ -5124,11 +5095,7 @@ exports.group = group;
5124
5095
*/
5125
5096
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5126
5097
function saveState(name, value) {
5127
- const filePath = process.env['GITHUB_STATE'] || '';
5128
- if (filePath) {
5129
- return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
5130
- }
5131
- command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
5098
+ command_1.issueCommand('save-state', { name }, value);
5132
5099
}
5133
5100
exports.saveState = saveState;
5134
5101
/**
@@ -5194,14 +5161,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
5194
5161
return result;
5195
5162
};
5196
5163
Object.defineProperty(exports, "__esModule", ({ value: true }));
5197
- exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
5164
+ exports.issueCommand = void 0;
5198
5165
// We use any as a valid input type
5199
5166
/* eslint-disable @typescript-eslint/no-explicit-any */
5200
5167
const fs = __importStar(__nccwpck_require__(7147));
5201
5168
const os = __importStar(__nccwpck_require__(2037));
5202
- const uuid_1 = __nccwpck_require__(8974);
5203
5169
const utils_1 = __nccwpck_require__(5278);
5204
- function issueFileCommand (command, message) {
5170
+ function issueCommand (command, message) {
5205
5171
const filePath = process.env[`GITHUB_${command}`];
5206
5172
if (!filePath) {
5207
5173
throw new Error(`Unable to find environment variable for file command ${command}`);
@@ -5213,22 +5179,7 @@ function issueFileCommand(command, message) {
5213
5179
encoding: 'utf8'
5214
5180
});
5215
5181
}
5216
- exports.issueFileCommand = issueFileCommand;
5217
- function prepareKeyValueMessage(key, value) {
5218
- const delimiter = `ghadelimiter_${uuid_1.v4()}`;
5219
- const convertedValue = utils_1.toCommandValue(value);
5220
- // These should realistically never happen, but just in case someone finds a
5221
- // way to exploit uuid generation let's not allow keys or values that contain
5222
- // the delimiter.
5223
- if (key.includes(delimiter)) {
5224
- throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
5225
- }
5226
- if (convertedValue.includes(delimiter)) {
5227
- throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
5228
- }
5229
- return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
5230
- }
5231
- exports.prepareKeyValueMessage = prepareKeyValueMessage;
5182
+ exports.issueCommand = issueCommand;
5232
5183
//# sourceMappingURL=file-command.js.map
5233
5184
5234
5185
/***/ }),
0 commit comments