From 51b9a65fc87b39b137f25f151cddb2f496047c61 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:37:22 +0000 Subject: [PATCH 1/2] Bump @actions/artifact from 2.1.8 to 2.1.9 in the npm-production group Bumps the npm-production group with 1 update: [@actions/artifact](https://github.com/actions/toolkit/tree/HEAD/packages/artifact). Updates `@actions/artifact` from 2.1.8 to 2.1.9 - [Changelog](https://github.com/actions/toolkit/blob/main/packages/artifact/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/artifact) --- updated-dependencies: - dependency-name: "@actions/artifact" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-production ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index f6d63ab..36b57a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.4.2-rc", "license": "MIT", "dependencies": { - "@actions/artifact": "^2.1.8", + "@actions/artifact": "^2.1.9", "@actions/cache": "^3.2.4", "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", @@ -45,9 +45,9 @@ } }, "node_modules/@actions/artifact": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.8.tgz", - "integrity": "sha512-kxgbllgF5f6mEdMeSW6WXlUbV1U77V9ECpA7LOYaY+Tm6RfXOm36EdXbpm+T9VPeaVqXK4QHLAgqay9GSyClgw==", + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/@actions/artifact/-/artifact-2.1.9.tgz", + "integrity": "sha512-f9JXC9JrwramDRJHZiIOKJo3PGw/V3riYegLj5kHi8YEJ2k72TNUd1zDW1BG50ILnzJ0cp1faDVJ2pSdolRQfg==", "dependencies": { "@actions/core": "^1.10.0", "@actions/github": "^5.1.1", diff --git a/package.json b/package.json index 0127d15..b070b21 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ ] }, "dependencies": { - "@actions/artifact": "^2.1.8", + "@actions/artifact": "^2.1.9", "@actions/cache": "^3.2.4", "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", From 645d2b0bffd07acc3d52e1c788e0550a839027bb Mon Sep 17 00:00:00 2001 From: Abhishek Anand Date: Sat, 7 Sep 2024 00:00:29 +0530 Subject: [PATCH 2/2] regenerated dist --- dist/index.js | 62 +++++++++++++++++++++++------------------------ package-lock.json | 14 +++++------ 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9d75164..d0b3c94 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2997,7 +2997,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; +exports.getUploadChunkTimeout = exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; const os_1 = __importDefault(__nccwpck_require__(22037)); // Used for controlling the highWaterMark value of the zip that is being streamed // The same value is used as the chunk size that is use during upload to blob storage @@ -3050,6 +3050,10 @@ function getConcurrency() { return concurrency > 300 ? 300 : concurrency; } exports.getConcurrency = getConcurrency; +function getUploadChunkTimeout() { + return 30000; // 30 seconds +} +exports.getUploadChunkTimeout = getUploadChunkTimeout; //# sourceMappingURL=config.js.map /***/ }), @@ -3298,37 +3302,34 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) { return __awaiter(this, void 0, void 0, function* () { let uploadByteCount = 0; let lastProgressTime = Date.now(); - let timeoutId; - const chunkTimer = (timeout) => { - // clear the previous timeout - if (timeoutId) { - clearTimeout(timeoutId); - } - timeoutId = setTimeout(() => { - const now = Date.now(); - // if there's been more than 30 seconds since the - // last progress event, then we'll consider the upload stalled - if (now - lastProgressTime > timeout) { - throw new Error('Upload progress stalled.'); - } - }, timeout); - return timeoutId; - }; + const abortController = new AbortController(); + const chunkTimer = (interval) => __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => { + const timer = setInterval(() => { + if (Date.now() - lastProgressTime > interval) { + reject(new Error('Upload progress stalled.')); + } + }, interval); + abortController.signal.addEventListener('abort', () => { + clearInterval(timer); + resolve(); + }); + }); + }); const maxConcurrency = (0, config_1.getConcurrency)(); const bufferSize = (0, config_1.getUploadChunkSize)(); const blobClient = new storage_blob_1.BlobClient(authenticatedUploadURL); const blockBlobClient = blobClient.getBlockBlobClient(); - const timeoutDuration = 300000; // 30 seconds core.debug(`Uploading artifact zip to blob storage with maxConcurrency: ${maxConcurrency}, bufferSize: ${bufferSize}`); const uploadCallback = (progress) => { core.info(`Uploaded bytes ${progress.loadedBytes}`); uploadByteCount = progress.loadedBytes; - chunkTimer(timeoutDuration); lastProgressTime = Date.now(); }; const options = { blobHTTPHeaders: { blobContentType: 'zip' }, - onProgress: uploadCallback + onProgress: uploadCallback, + abortSignal: abortController.signal }; let sha256Hash = undefined; const uploadStream = new stream.PassThrough(); @@ -3337,9 +3338,10 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) { zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check core.info('Beginning upload of artifact content to blob storage'); try { - // Start the chunk timer - timeoutId = chunkTimer(timeoutDuration); - yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options); + yield Promise.race([ + blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options), + chunkTimer((0, config_1.getUploadChunkTimeout)()) + ]); } catch (error) { if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) { @@ -3348,10 +3350,7 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) { throw error; } finally { - // clear the timeout whether or not the upload completes - if (timeoutId) { - clearTimeout(timeoutId); - } + abortController.abort(); } core.info('Finished uploading artifact content to blob storage!'); hashStream.end(); @@ -3778,7 +3777,6 @@ exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRE const stream = __importStar(__nccwpck_require__(12781)); const archiver = __importStar(__nccwpck_require__(43084)); const core = __importStar(__nccwpck_require__(42186)); -const fs_1 = __nccwpck_require__(57147); const config_1 = __nccwpck_require__(74610); exports.DEFAULT_COMPRESSION_LEVEL = 6; // Custom stream transformer so we can set the highWaterMark property @@ -3810,7 +3808,7 @@ function createZipUploadStream(uploadSpecification, compressionLevel = exports.D for (const file of uploadSpecification) { if (file.sourcePath !== null) { // Add a normal file to the zip - zip.append((0, fs_1.createReadStream)(file.sourcePath), { + zip.file(file.sourcePath, { name: file.destinationPath }); } @@ -113618,7 +113616,7 @@ UnzipStream.prototype._prepareOutStream = function (vars, entry) { var isDirectory = vars.uncompressedSize === 0 && /[\/\\]$/.test(entry.path); // protect against malicious zip files which want to extract to parent dirs - entry.path = entry.path.replace(/^([/\\]*[.]+[/\\]+)*[/\\]*/, ""); + entry.path = entry.path.replace(/(?<=^|[/\\]+)[.][.]+(?=[/\\]+|$)/g, "."); entry.type = isDirectory ? 'Directory' : 'File'; entry.isDirectory = isDirectory; @@ -113682,7 +113680,7 @@ UnzipStream.prototype._prepareOutStream = function (vars, entry) { entry.skip = true; setImmediate(() => { - entry.emit("error", new Error(message)); + self.emit('error', new Error(message)); }); // try to skip over this entry @@ -141807,7 +141805,7 @@ module.exports = index; /***/ ((module) => { "use strict"; -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"}}'); +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"}}'); /***/ }), diff --git a/package-lock.json b/package-lock.json index 36b57a3..f930622 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8287,12 +8287,12 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -9979,9 +9979,9 @@ "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==" }, "node_modules/unzip-stream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.1.tgz", - "integrity": "sha512-RzaGXLNt+CW+T41h1zl6pGz3EaeVhYlK+rdAap+7DxW5kqsqePO8kRtWPaCiVqdhZc86EctSPVYNix30YOMzmw==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/unzip-stream/-/unzip-stream-0.3.4.tgz", + "integrity": "sha512-PyofABPVv+d7fL7GOpusx7eRT9YETY2X04PhwbSipdj6bMxVCFJrr+nm0Mxqbf9hUiTin/UsnuFWBXlDZFy0Cw==", "dependencies": { "binary": "^0.3.0", "mkdirp": "^0.5.1"