@@ -2997,7 +2997,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29972997 return (mod && mod.__esModule) ? mod : { "default": mod };
29982998};
29992999Object.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;
30013001const os_1 = __importDefault(__nccwpck_require__(22037));
30023002// Used for controlling the highWaterMark value of the zip that is being streamed
30033003// The same value is used as the chunk size that is use during upload to blob storage
@@ -3050,10 +3050,6 @@ function getConcurrency() {
30503050 return concurrency > 300 ? 300 : concurrency;
30513051}
30523052exports.getConcurrency = getConcurrency;
3053- function getUploadChunkTimeout() {
3054- return 30000; // 30 seconds
3055- }
3056- exports.getUploadChunkTimeout = getUploadChunkTimeout;
30573053//# sourceMappingURL=config.js.map
30583054
30593055/***/ }),
@@ -3302,34 +3298,37 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
33023298 return __awaiter(this, void 0, void 0, function* () {
33033299 let uploadByteCount = 0;
33043300 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+ };
33193317 const maxConcurrency = (0, config_1.getConcurrency)();
33203318 const bufferSize = (0, config_1.getUploadChunkSize)();
33213319 const blobClient = new storage_blob_1.BlobClient(authenticatedUploadURL);
33223320 const blockBlobClient = blobClient.getBlockBlobClient();
3321+ const timeoutDuration = 300000; // 30 seconds
33233322 core.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`);
33243323 const uploadCallback = (progress) => {
33253324 core.info(`Uploaded bytes ${progress.loadedBytes}`);
33263325 uploadByteCount = progress.loadedBytes;
3326+ chunkTimer(timeoutDuration);
33273327 lastProgressTime = Date.now();
33283328 };
33293329 const options = {
33303330 blobHTTPHeaders: { blobContentType: 'zip' },
3331- onProgress: uploadCallback,
3332- abortSignal: abortController.signal
3331+ onProgress: uploadCallback
33333332 };
33343333 let sha256Hash = undefined;
33353334 const uploadStream = new stream.PassThrough();
@@ -3338,10 +3337,9 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
33383337 zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check
33393338 core.info('Beginning upload of artifact content to blob storage');
33403339 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);
33453343 }
33463344 catch (error) {
33473345 if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
@@ -3350,7 +3348,10 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
33503348 throw error;
33513349 }
33523350 finally {
3353- abortController.abort();
3351+ // clear the timeout whether or not the upload completes
3352+ if (timeoutId) {
3353+ clearTimeout(timeoutId);
3354+ }
33543355 }
33553356 core.info('Finished uploading artifact content to blob storage!');
33563357 hashStream.end();
@@ -3777,6 +3778,7 @@ exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRE
37773778const stream = __importStar(__nccwpck_require__(12781));
37783779const archiver = __importStar(__nccwpck_require__(43084));
37793780const core = __importStar(__nccwpck_require__(42186));
3781+ const fs_1 = __nccwpck_require__(57147);
37803782const config_1 = __nccwpck_require__(74610);
37813783exports.DEFAULT_COMPRESSION_LEVEL = 6;
37823784// Custom stream transformer so we can set the highWaterMark property
@@ -3808,7 +3810,7 @@ function createZipUploadStream(uploadSpecification, compressionLevel = exports.D
38083810 for (const file of uploadSpecification) {
38093811 if (file.sourcePath !== null) {
38103812 // Add a normal file to the zip
3811- zip.file( file.sourcePath, {
3813+ zip.append((0, fs_1.createReadStream)( file.sourcePath) , {
38123814 name: file.destinationPath
38133815 });
38143816 }
@@ -136150,7 +136152,7 @@ module.exports = index;
136150136152/***/ ((module) => {
136151136153
136152136154"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"}}');
136154136156
136155136157/***/ }),
136156136158
0 commit comments