Skip to content

Commit

Permalink
chore: update bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjur committed Oct 14, 2024
1 parent cc0dba6 commit 978f6e0
Showing 1 changed file with 37 additions and 45 deletions.
82 changes: 37 additions & 45 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.getUploadChunkTimeout = exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0;
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
Expand Down Expand Up @@ -3025,9 +3025,8 @@ function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGheHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGheHost && !isLocalHost;
const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST');
return !isGitHubHost && !isGheHost;
}
exports.isGhes = isGhes;
function getGitHubWorkspaceDir() {
Expand All @@ -3050,10 +3049,6 @@ function getConcurrency() {
return concurrency > 300 ? 300 : concurrency;
}
exports.getConcurrency = getConcurrency;
function getUploadChunkTimeout() {
return 300000; // 5 minutes
}
exports.getUploadChunkTimeout = getUploadChunkTimeout;
//# sourceMappingURL=config.js.map

/***/ }),
Expand Down Expand Up @@ -3302,34 +3297,37 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
return __awaiter(this, void 0, void 0, function* () {
let uploadByteCount = 0;
let lastProgressTime = Date.now();
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();
});
});
});
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 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,
abortSignal: abortController.signal
onProgress: uploadCallback
};
let sha256Hash = undefined;
const uploadStream = new stream.PassThrough();
Expand All @@ -3338,10 +3336,9 @@ 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 {
yield Promise.race([
blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options),
chunkTimer((0, config_1.getUploadChunkTimeout)())
]);
// Start the chunk timer
timeoutId = chunkTimer(timeoutDuration);
yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options);
}
catch (error) {
if (errors_1.NetworkError.isNetworkErrorCode(error === null || error === void 0 ? void 0 : error.code)) {
Expand All @@ -3350,7 +3347,10 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
throw error;
}
finally {
abortController.abort();
// clear the timeout whether or not the upload completes
if (timeoutId) {
clearTimeout(timeoutId);
}
}
core.info('Finished uploading artifact content to blob storage!');
hashStream.end();
Expand Down Expand Up @@ -3700,11 +3700,10 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
- file3.txt
*/
for (let file of filesToZip) {
const stats = fs.lstatSync(file, { throwIfNoEntry: false });
if (!stats) {
if (!fs.existsSync(file)) {
throw new Error(`File ${file} does not exist`);
}
if (!stats.isDirectory()) {
if (!fs.statSync(file).isDirectory()) {
// Normalize and resolve, this allows for either absolute or relative paths to be used
file = (0, path_1.normalize)(file);
file = (0, path_1.resolve)(file);
Expand All @@ -3716,8 +3715,7 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
(0, path_and_artifact_name_validation_1.validateFilePath)(uploadPath);
specification.push({
sourcePath: file,
destinationPath: uploadPath,
stats
destinationPath: uploadPath
});
}
else {
Expand All @@ -3726,8 +3724,7 @@ function getUploadZipSpecification(filesToZip, rootDirectory) {
(0, path_and_artifact_name_validation_1.validateFilePath)(directoryPath);
specification.push({
sourcePath: null,
destinationPath: directoryPath,
stats
destinationPath: directoryPath
});
}
}
Expand Down Expand Up @@ -3778,9 +3775,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createZipUploadStream = exports.ZipUploadStream = exports.DEFAULT_COMPRESSION_LEVEL = void 0;
const stream = __importStar(__nccwpck_require__(12781));
const promises_1 = __nccwpck_require__(73292);
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
Expand Down Expand Up @@ -3811,13 +3808,8 @@ function createZipUploadStream(uploadSpecification, compressionLevel = exports.D
zip.on('end', zipEndCallback);
for (const file of uploadSpecification) {
if (file.sourcePath !== null) {
// Check if symlink and resolve the source path
let sourcePath = file.sourcePath;
if (file.stats.isSymbolicLink()) {
sourcePath = yield (0, promises_1.realpath)(file.sourcePath);
}
// Add the file to the zip
zip.file(sourcePath, {
// Add a normal file to the zip
zip.append((0, fs_1.createReadStream)(file.sourcePath), {
name: file.destinationPath
});
}
Expand Down Expand Up @@ -138825,7 +138817,7 @@ module.exports = index;
/***/ ((module) => {

"use strict";
module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.1.11","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","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.7","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"}}');

/***/ }),

Expand Down

0 comments on commit 978f6e0

Please sign in to comment.