@@ -2997,7 +2997,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2997
2997
return (mod && mod.__esModule) ? mod : { "default": mod };
2998
2998
};
2999
2999
Object.defineProperty(exports, "__esModule", ({ value: true }));
3000
- exports.getUploadChunkTimeout = exports. getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0;
3000
+ exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0;
3001
3001
const os_1 = __importDefault(__nccwpck_require__(22037));
3002
3002
// Used for controlling the highWaterMark value of the zip that is being streamed
3003
3003
// The same value is used as the chunk size that is use during upload to blob storage
@@ -3050,10 +3050,6 @@ function getConcurrency() {
3050
3050
return concurrency > 300 ? 300 : concurrency;
3051
3051
}
3052
3052
exports.getConcurrency = getConcurrency;
3053
- function getUploadChunkTimeout() {
3054
- return 30000; // 30 seconds
3055
- }
3056
- exports.getUploadChunkTimeout = getUploadChunkTimeout;
3057
3053
//# sourceMappingURL=config.js.map
3058
3054
3059
3055
/***/ }),
@@ -3302,34 +3298,37 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
3302
3298
return __awaiter(this, void 0, void 0, function* () {
3303
3299
let uploadByteCount = 0;
3304
3300
let lastProgressTime = Date.now();
3305
- const abortController = new AbortController();
3306
- const chunkTimer = (interval) => __awaiter(this, void 0, void 0, function* () {
3307
- return new Promise((resolve, reject) => {
3308
- const timer = setInterval(() => {
3309
- if (Date.now() - lastProgressTime > interval) {
3310
- reject(new Error('Upload progress stalled.'));
3311
- }
3312
- }, interval);
3313
- abortController.signal.addEventListener('abort', () => {
3314
- clearInterval(timer);
3315
- resolve();
3316
- });
3317
- });
3318
- });
3301
+ let timeoutId;
3302
+ const chunkTimer = (timeout) => {
3303
+ // clear the previous timeout
3304
+ if (timeoutId) {
3305
+ clearTimeout(timeoutId);
3306
+ }
3307
+ timeoutId = setTimeout(() => {
3308
+ const now = Date.now();
3309
+ // if there's been more than 30 seconds since the
3310
+ // last progress event, then we'll consider the upload stalled
3311
+ if (now - lastProgressTime > timeout) {
3312
+ throw new Error('Upload progress stalled.');
3313
+ }
3314
+ }, timeout);
3315
+ return timeoutId;
3316
+ };
3319
3317
const maxConcurrency = (0, config_1.getConcurrency)();
3320
3318
const bufferSize = (0, config_1.getUploadChunkSize)();
3321
3319
const blobClient = new storage_blob_1.BlobClient(authenticatedUploadURL);
3322
3320
const blockBlobClient = blobClient.getBlockBlobClient();
3321
+ const timeoutDuration = 300000; // 30 seconds
3323
3322
core.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`);
3324
3323
const uploadCallback = (progress) => {
3325
3324
core.info(`Uploaded bytes ${progress.loadedBytes}`);
3326
3325
uploadByteCount = progress.loadedBytes;
3326
+ chunkTimer(timeoutDuration);
3327
3327
lastProgressTime = Date.now();
3328
3328
};
3329
3329
const options = {
3330
3330
blobHTTPHeaders: { blobContentType: 'zip' },
3331
- onProgress: uploadCallback,
3332
- abortSignal: abortController.signal
3331
+ onProgress: uploadCallback
3333
3332
};
3334
3333
let sha256Hash = undefined;
3335
3334
const uploadStream = new stream.PassThrough();
@@ -3338,10 +3337,9 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
3338
3337
zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check
3339
3338
core.info('Beginning upload of artifact content to blob storage');
3340
3339
try {
3341
- yield Promise.race([
3342
- blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options),
3343
- chunkTimer((0, config_1.getUploadChunkTimeout)())
3344
- ]);
3340
+ // Start the chunk timer
3341
+ timeoutId = chunkTimer(timeoutDuration);
3342
+ yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options);
3345
3343
}
3346
3344
catch (error) {
3347
3345
if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
@@ -3350,7 +3348,10 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
3350
3348
throw error;
3351
3349
}
3352
3350
finally {
3353
- abortController.abort();
3351
+ // clear the timeout whether or not the upload completes
3352
+ if (timeoutId) {
3353
+ clearTimeout(timeoutId);
3354
+ }
3354
3355
}
3355
3356
core.info('Finished uploading artifact content to blob storage!');
3356
3357
hashStream.end();
@@ -3777,6 +3778,7 @@ exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRE
3777
3778
const stream = __importStar(__nccwpck_require__(12781));
3778
3779
const archiver = __importStar(__nccwpck_require__(43084));
3779
3780
const core = __importStar(__nccwpck_require__(42186));
3781
+ const fs_1 = __nccwpck_require__(57147);
3780
3782
const config_1 = __nccwpck_require__(74610);
3781
3783
exports.DEFAULT_COMPRESSION_LEVEL = 6;
3782
3784
// Custom stream transformer so we can set the highWaterMark property
@@ -3808,7 +3810,7 @@ function createZipUploadStream(uploadSpecification, compressionLevel = exports.D
3808
3810
for (const file of uploadSpecification) {
3809
3811
if (file.sourcePath !== null) {
3810
3812
// Add a normal file to the zip
3811
- zip.file( file.sourcePath, {
3813
+ zip.append((0, fs_1.createReadStream)( file.sourcePath) , {
3812
3814
name: file.destinationPath
3813
3815
});
3814
3816
}
@@ -136150,7 +136152,7 @@ module.exports = index;
136150
136152
/***/ ((module) => {
136151
136153
136152
136154
"use strict";
136153
- module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.9","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
136155
+ module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.8","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","archiver":"^7.0.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzip-stream":"^0.3.1"},"devDependencies":{"@types/archiver":"^5.3.2","@types/unzip-stream":"^0.3.4","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
136154
136156
136155
136157
/***/ }),
136156
136158
0 commit comments