8000 *: switch use-python to use blacksmith cache · useblacksmith/setup-python@d9e68a4 · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script type="application/json" data-target="react-app.embeddedData">{"payload":{"commit":{"oid":"d9e68a44980b864e1f088af6a825652367d0abfa","url":"/useblacksmith/setup-python/commit/d9e68a44980b864e1f088af6a825652367d0abfa","authoredDate":"2024-02-06T13:05:42.000-05:00","committedDate":"2024-02-06T13:05:42.000-05:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003e*: switch use-python to use blacksmith cache\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"","authors":[{"login":"adityamaru","displayName":"Aditya Maru","avatarUrl":"https://avatars.githubusercontent.com/u/13837382?v=4","path":"/adityamaru","isGitHub":false}],"committerAttribution":false,"committer":{"login":"adityamaru","displayName":"Aditya Maru","avatarUrl":"https://avatars.githubusercontent.com/u/13837382?v=4","path":"/adityamaru","isGitHub":false},"parents":["871daa956ca9ea99f3c3e30acb424b7960676734"],"globalRelayId":"C_kwDOLO0m_NoAKGQ5ZTY4YTQ0OTgwYjg2NGUxZjA4OGFmNmE4MjU2NTIzNjdkMGFiZmE","sha1":"871daa956ca9ea99f3c3e30acb424b7960676734","sha2":"d9e68a44980b864e1f088af6a825652367d0abfa"},"currentUser":null,"repo":{"id":753739516,"defaultBranch":"main","name":"setup-python","ownerLogin":"useblacksmith","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2024-02-06T17:48:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/156274793?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":168,"text":"@@ -169,7 +169,7 @@ exports.restoreCache = restoreCache;","html":"@@ -169,7 +169,7 @@ exports.restoreCache = restoreCache;","displayNoNewLineWarning":false,"position":0,"left":168,"right":168},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":169,"text":" * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails","html":" * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails","displayNoNewLineWarning":false,"position":1,"left":169,"right":169},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":170,"text":" */","html":" */","displayNoNewLineWarning":false,"position":2,"left":170,"right":170},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":171,"text":" function saveCache(paths, key, options, enableCrossOsArchive = false) {","html":" function saveCache(paths, key, options, enableCrossOsArchive = false) {","displayNoNewLineWarning":false,"position":3,"left":171,"right":171},{"stylingDirective":null,"type":"DELETION","blobLineNumber":172,"text":"- var _a, _b, _c, _d, _e;","html":"- var _a, _b, _c, _d, _e;","displayNoNewLineWarning":false,"position":4,"left":172,"right":171},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":172,"text":"+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;","html":"+ var _a, _b, _c, _d, _e\u003cspan class=\"x x-first x-last\"\u003e, _f, _g, _h, _j\u003c/span\u003e;","displayNoNewLineWarning":false,"position":5,"left":172,"right":172},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":173,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":6,"left":173,"right":173},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":174,"text":" checkPaths(paths);","html":" checkPaths(paths);","displayNoNewLineWarning":false,"position":7,"left":174,"right":174},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":175,"text":" checkKey(key);","html":" checkKey(key);","displayNoNewLineWarning":false,"position":8,"left":175,"right":175},{"stylingDirective":null,"type":"HUNK","blobLineNumber":188,"text":"@@ -189,12 +189,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {","html":"@@ -189,12 +189,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {","displayNoNewLineWarning":false,"position":9,"left":188,"right":188},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":189,"text":" if (core.isDebug()) {","html":" if (core.isDebug()) {","displayNoNewLineWarning":false,"position":10,"left":189,"right":189},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":190,"text":" yield (0, tar_1.listTar)(archivePath, compressionMethod);","html":" yield (0, tar_1.listTar)(archivePath, compressionMethod);","displayNoNewLineWarning":false,"position":11,"left":190,"right":190},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":191,"text":" }","html":" }","displayNoNewLineWarning":false,"position":12,"left":191,"right":191},{"stylingDirective":null,"type":"DELETION","blobLineNumber":192,"text":"- const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit","html":"- const fileSizeLimit = \u003cspan class=\"x x-first x-last\"\u003e10\u003c/span\u003e * 1024 * 1024 * 1024; // \u003cspan class=\"x x-first x-last\"\u003e10GB\u003c/span\u003e per repo limit","displayNoNewLineWarning":false,"position":13,"left":192,"right":191},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":192,"text":"+ const fileSizeLimit = 25 * 1024 * 1024 * 1024; // 25GB per repo limit","html":"+ const fileSizeLimit = \u003cspan class=\"x x-first x-last\"\u003e25\u003c/span\u003e * 1024 * 1024 * 1024; // \u003cspan class=\"x x-first x-last\"\u003e25GB\u003c/span\u003e per repo limit","displayNoNewLineWarning":false,"position":14,"left":192,"right":192},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":193,"text":" const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);","html":" const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);","displayNoNewLineWarning":false,"position":15,"left":193,"right":193},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":194,"text":" core.debug(`File Size: ${archiveFileSize}`);","html":" core.debug(`File Size: ${archiveFileSize}`);","displayNoNewLineWarning":false,"position":16,"left":194,"right":194},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":195,"text":" // For GHES, this check will take place in ReserveCache API with enterprise file size limit","html":" // For GHES, this check will take place in ReserveCache API with enterprise file size limit","displayNoNewLineWarning":false,"position":17,"left":195,"right":195},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":196,"text":" if (archiveFileSize \u003e fileSizeLimit \u0026\u0026 !utils.isGhes()) {","html":" if (archiveFileSize \u0026gt; fileSizeLimit \u0026amp;\u0026amp; !utils.isGhes()) {","displayNoNewLineWarning":false,"position":18,"left":196,"right":196},{"stylingDirective":null,"type":"DELETION","blobLineNumber":197,"text":"- throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);","html":"- throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the \u003cspan class=\"x x-first x-last\"\u003e10GB\u003c/span\u003e limit, not saving cache.`);","displayNoNewLineWarning":false,"position":19,"left":197,"right":196},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":197,"text":"+ throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 25GB limit, not saving cache.`);","html":"+ throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the \u003cspan class=\"x x-first x-last\"\u003e25GB\u003c/span\u003e limit, not saving cache.`);","displayNoNewLineWarning":false,"position":20,"left":197,"right":197},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":198,"text":" }","html":" }","displayNoNewLineWarning":false,"position":21,"left":198,"right":198},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":199,"text":" core.debug('Reserving Cache');","html":" core.debug(\u0026#39;Reserving Cache\u0026#39;);","displayNoNewLineWarning":false,"position":22,"left":199,"right":199},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":200,"text":" const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {","html":" const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {","displayNoNewLineWarning":false,"position":23,"left":200,"right":200},{"stylingDirective":null,"type":"HUNK","blobLineNumber":211,"text":"@@ -212,7 +212,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {","html":"@@ -212,7 +212,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {","displayNoNewLineWarning":false,"position":24,"left":211,"right":211},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":212,"text":" throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);","html":" throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);","displayNoNewLineWarning":false,"position":25,"left":212,"right":212},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":213,"text":" }","html":" }","displayNoNewLineWarning":false,"position":26,"left":213,"right":213},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":214,"text":" core.debug(`Saving Cache (ID: ${cacheId})`);","html":" core.debug(`Saving Cache (ID: ${cacheId})`);","displayNoNewLineWarning":false,"position":27,"left":214,"right":214},{"stylingDirective":null,"type":"DELETION","blobLineNumber":215,"text":"- yield cacheHttpClient.saveCache(cacheId, archivePath, options);","html":"- yield cacheHttpClient.saveCache(cacheId, archivePath, \u003cspan class=\"x x-first x-last\"\u003eoptions\u003c/span\u003e);","displayNoNewLineWarning":false,"position":28,"left":215,"right":214},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":215,"text":"+ yield cacheHttpClient.saveCache(cacheId, archivePath, (_g = (_f = reserveCacheResponse.result) === null || _f === void 0 ? void 0 : _f.uploadUrls) !== null \u0026\u0026 _g !== void 0 ? _g : [], (_j = (_h = reserveCacheResponse.result) === null || _h === void 0 ? void 0 : _h.uploadId) !== null \u0026\u0026 _j !== void 0 ? _j : '');","html":"+ yield cacheHttpClient.saveCache(cacheId, archivePath, \u003cspan class=\"x x-first x-last\"\u003e(_g = (_f = reserveCacheResponse.result) === null || _f === void 0 ? void 0 : _f.uploadUrls) !== null \u0026amp;\u0026amp; _g !== void 0 ? _g : [], (_j = (_h = reserveCacheResponse.result) === null || _h === void 0 ? void 0 : _h.uploadId) !== null \u0026amp;\u0026amp; _j !== void 0 ? _j : \u0026#39;\u0026#39;\u003c/span\u003e);","displayNoNewLineWarning":false,"position":29,"left":215,"right":215},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":216,"text":" }","html":" }","displayNoNewLineWarning":false,"position":30,"left":216,"right":216},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":217,"text":" catch (error) {","html":" catch (error) {","displayNoNewLineWarning":false,"position":31,"left":217,"right":217},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":218,"text":" const typedError = error;","html":" const typedError = error;","displayNoNewLineWarning":false,"position":32,"left":218,"right":218},{"stylingDirective":null,"type":"HUNK","blobLineNumber":220,"text":"@@ -221,6 +221,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {","html":"@@ -221,6 +221,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {","displayNoNewLineWarning":false,"position":33,"left":220,"right":220},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":221,"text":" }","html":" }","displayNoNewLineWarning":false,"position":34,"left":221,"right":221},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":222,"text":" else if (typedError.name === ReserveCacheError.name) {","html":" else if (typedError.name === ReserveCacheError.name) {","displayNoNewLineWarning":false,"position":35,"left":222,"right":222},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":223,"text":" core.info(`Failed to save: ${typedError.message}`);","html":" core.info(`Failed to save: ${typedError.message}`);","displayNoNewLineWarning":false,"position":36,"left":223,"right":223},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":224,"text":"+ core.debug(JSON.stringify(error));","html":"+ core.debug(JSON.stringify(error));","displayNoNewLineWarning":false,"position":37,"left":223,"right":224},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":225,"text":" }","html":" }","displayNoNewLineWarning":false,"position":38,"left":224,"right":225},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":226,"text":" else {","html":" else {","displayNoNewLineWarning":false,"position":39,"left":225,"right":226},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":227,"text":" core.warning(`Failed to save: ${typedError.message}`);","html":" core.warning(`Failed to save: ${typedError.message}`);","displayNoNewLineWarning":false,"position":40,"left":226,"right":227},{"stylingDirective":null,"type":"HUNK","blobLineNumber":294,"text":"@@ -294,29 +295,32 @@ const options_1 = __nccwpck_require__(6215);","html":"@@ -294,29 +295,32 @@ const options_1 = __nccwpck_require__(6215);","displayNoNewLineWarning":false,"position":41,"left":293,"right":294},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":295,"text":" const requestUtils_1 = __nccwpck_require__(3981);","html":" const requestUtils_1 = __nccwpck_require__(3981);","displayNoNewLineWarning":false,"position":42,"left":294,"right":295},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":296,"text":" const versionSalt = '1.0';","html":" const versionSalt = \u0026#39;1.0\u0026#39;;","displayNoNewLineWarning":false,"position":43,"left":295,"right":296},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":297,"text":" function getCacheApiUrl(resource) {","html":" function getCacheApiUrl(resource) {","displayNoNewLineWarning":false,"position":44,"left":296,"right":297},{"stylingDirective":null,"type":"DELETION","blobLineNumber":297,"text":"- const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';","html":"- const baseUrl = process.env[\u0026#39;\u003cspan class=\"x x-first x-last\"\u003eACTIONS_CACHE_URL\u003c/span\u003e\u0026#39;] || \u0026#39;\u0026#39;;","displayNoNewLineWarning":false,"position":45,"left":297,"right":297},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":298,"text":"+ const baseUrl = process.env['BLACKSMITH_CACHE_URL'] || 'https://api.blacksmith.sh/cache';","html":"+ const baseUrl = process.env[\u0026#39;\u003cspan class=\"x x-first x-last\"\u003eBLACKSMITH_CACHE_URL\u003c/span\u003e\u0026#39;] || \u0026#39;\u003cspan class=\"x x-first x-last\"\u003ehttps://api.blacksmith.sh/cache\u003c/span\u003e\u0026#39;;","displayNoNewLineWarning":false,"position":46,"left":297,"right":298},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":299,"text":" if (!baseUrl) {","html":" if (!baseUrl) {","displayNoNewLineWarning":false,"position":47,"left":298,"right":299},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":300,"text":" throw new Error('Cache Service Url not found, unable to restore cache.');","html":" throw new Error(\u0026#39;Cache Service Url not found, unable to restore cache.\u0026#39;);","displayNoNewLineWarning":false,"position":48,"left":299,"right":300},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":301,"text":" }","html":" }","displayNoNewLineWarning":false,"position":49,"left":300,"right":301},{"stylingDirective":null,"type":"DELETION","blobLineNumber":301,"text":"- const url = `${baseUrl}_apis/artifactcache/${resource}`;","html":"- const url = `${baseUrl}\u003cspan class=\"x x-first x-last\"\u003e_apis/artifactcache\u003c/span\u003e/${resource}`;","displayNoNewLineWarning":false,"position":50,"left":301,"right":301},{"stylingDirective":null,"type":"DELETION","blobLineNumber":302,"text":"- core.debug(`Resource Url: ${url}`);","html":"- core.debug(`\u003cspan class=\"x x-first x-last\"\u003eResource Url\u003c/span\u003e: ${url}`);","displayNoNewLineWarning":false,"position":51,"left":302,"right":301},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":302,"text":"+ const url = `${baseUrl}/${resource}`;","html":"+ const url = `${baseUrl}/${resource}`;","displayNoNewLineWarning":false,"position":52,"left":302,"right":302},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":303,"text":"+ core.debug(`Blacksmith cache resource URL: ${url}; version: 3.2.40`);","html":"+ core.debug(`\u003cspan class=\"x x-first x-last\"\u003eBlacksmith cache resource URL\u003c/span\u003e: ${url}\u003cspan class=\"x x-first x-last\"\u003e; version: 3.2.40\u003c/span\u003e`);","displayNoNewLineWarning":false,"position":53,"left":302,"right":303},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":304,"text":" return url;","html":" return url;","displayNoNewLineWarning":false,"position":54,"left":303,"right":304},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":305,"text":" }","html":" }","displayNoNewLineWarning":false,"position":55,"left":304,"right":305},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":306,"text":" function createAcceptHeader(type, apiVersion) {","html":" function createAcceptHeader(type, apiVersion) {","displayNoNewLineWarning":false,"position":56,"left":305,"right":306},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":307,"text":" return `${type};api-version=${apiVersion}`;","html":" return `${type};api-version=${apiVersion}`;","displayNoNewLineWarning":false,"position":57,"left":306,"right":307},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":308,"text":" }","html":" }","displayNoNewLineWarning":false,"position":58,"left":307,"right":308},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":309,"text":" function getRequestOptions() {","html":" function getRequestOptions() {","displayNoNewLineWarning":false,"position":59,"left":308,"right":309},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":310,"text":"+ core.debug(`Setting GITHUB_REPO_NAME: ${process.env['GITHUB_REPO_NAME']}`);","html":"+ core.debug(`Setting GITHUB_REPO_NAME: ${process.env[\u0026#39;GITHUB_REPO_NAME\u0026#39;]}`);","displayNoNewLineWarning":false,"position":60,"left":308,"right":310},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":311,"text":" const requestOptions = {","html":" const requestOptions = {","displayNoNewLineWarning":false,"position":61,"left":309,"right":311},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":312,"text":" headers: {","html":" headers: {","displayNoNewLineWarning":false,"position":62,"left":310,"right":312},{"stylingDirective":null,"type":"DELETION","blobLineNumber":311,"text":"- Accept: createAcceptHeader('application/json', '6.0-preview.1')","html":"- Accept: createAcceptHeader(\u0026#39;application/json\u0026#39;, \u0026#39;6.0-preview.1\u0026#39;)","displayNoNewLineWarning":false,"position":63,"left":311,"right":312},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":313,"text":"+ Accept: createAcceptHeader('application/json', '6.0-preview.1'),","html":"+ Accept: createAcceptHeader(\u0026#39;application/json\u0026#39;, \u0026#39;6.0-preview.1\u0026#39;),","displayNoNewLineWarning":false,"position":64,"left":311,"right":313},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":314,"text":"+ 'X-Github-Repo-Name': process.env['GITHUB_REPO_NAME']","html":"+ \u0026#39;X-Github-Repo-Name\u0026#39;: process.env[\u0026#39;GITHUB_REPO_NAME\u0026#39;]","displayNoNewLineWarning":false,"position":65,"left":311,"right":314},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":315,"text":" }","html":" }","displayNoNewLineWarning":false,"position":66,"left":312,"right":315},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":316,"text":" };","html":" };","displayNoNewLineWarning":false,"position":67,"left":313,"right":316},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":317,"text":" return requestOptions;","html":" return requestOptions;","displayNoNewLineWarning":false,"position":68,"left":314,"right":317},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":318,"text":" }","html":" }","displayNoNewLineWarning":false,"position":69,"left":315,"right":318},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":319,"text":" function createHttpClient() {","html":" function createHttpClient() {","displayNoNewLineWarning":false,"position":70,"left":316,"right":319},{"stylingDirective":null,"type":"DELETION","blobLineNumber":317,"text":"- const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';","html":"- const token = process.env[\u0026#39;ACTIONS_RUNTIME_TOKEN\u0026#39;] || \u0026#39;\u0026#39;;","displayNoNewLineWarning":false,"position":71,"left":317,"right":319},{"stylingDirective":null,"type":"DELETION","blobLineNumber":318,"text":"- const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);","html":"- const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);","displayNoNewLineWarning":false,"position":72,"left":318,"right":319},{"stylingDirective":null,"type":"DELETION","blobLineNumber":319,"text":"- return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());","html":"- return new http_client_1.HttpClient(\u0026#39;actions/cache\u0026#39;, [bearerCredentialHandler], getRequestOptions());","displayNoNewLineWarning":false,"position":73,"left":319,"right":319},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":320,"text":"+ const token = process.env['BLACKSMITH_CACHE_TOKEN'];","html":"+ const token = process.env[\u0026#39;BLACKSMITH_CACHE_TOKEN\u0026#39;];","displayNoNewLineWarning":false,"position":74,"left":319,"right":320},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":321,"text":"+ core.debug(`BLACKSMITH_CACHE_TOKEN: ${token}`);","html":"+ core.debug(`BLACKSMITH_CACHE_TOKEN: ${token}`);","displayNoNewLineWarning":false,"position":75,"left":319,"right":321},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":322,"text":"+ const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token !== null \u0026\u0026 token !== void 0 ? token : '');","html":"+ const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token !== null \u0026amp;\u0026amp; token !== void 0 ? token : \u0026#39;\u0026#39;);","displayNoNewLineWarning":false,"position":76,"left":319,"right":322},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":323,"text":"+ return new http_client_1.HttpClient('useblacksmith/cache', [bearerCredentialHandler], getRequestOptions());","html":"+ return new http_client_1.HttpClient(\u0026#39;useblacksmith/cache\u0026#39;, [bearerCredentialHandler], getRequestOptions());","displayNoNewLineWarning":false,"position":77,"left":319,"right":323},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":324,"text":" }","html":" }","displayNoNewLineWarning":false,"position":78,"left":320,"right":324},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":325,"text":" function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {","html":" function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {","displayNoNewLineWarning":false,"position":79,"left":321,"right":325},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":326,"text":" const components = paths;","html":" const components = paths;","displayNoNewLineWarning":false,"position":80,"left":322,"right":326},{"stylingDirective":null,"type":"HUNK","blobLineNumber":341,"text":"@@ -338,7 +342,7 @@ function getCacheEntry(keys, paths, options) {","html":"@@ -338,7 +342,7 @@ function getCacheEntry(keys, paths, options) {","displayNoNewLineWarning":false,"position":81,"left":337,"right":341},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":342,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":82,"left":338,"right":342},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":343,"text":" const httpClient = createHttpClient();","html":" const httpClient = createHttpClient();","displayNoNewLineWarning":false,"position":83,"left":339,"right":343},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":344,"text":" const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);","html":" const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);","displayNoNewLineWarning":false,"position":84,"left":340,"right":344},{"stylingDirective":null,"type":"DELETION","blobLineNumber":341,"text":"- const resource = `cache?keys=${encodeURIComponent(keys.join(','))}\u0026version=${version}`;","html":"- const resource = `\u003cspan class=\"x x-first x-last\"\u003ecache\u003c/span\u003e?keys=${encodeURIComponent(keys.join(\u0026#39;,\u0026#39;))}\u0026amp;version=${version}`;","displayNoNewLineWarning":false,"position":85,"left":341,"right":344},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":345,"text":"+ const resource = `?keys=${encodeURIComponent(keys.join(','))}\u0026version=${version}`;","html":"+ const resource = `?keys=${encodeURIComponent(keys.join(\u0026#39;,\u0026#39;))}\u0026amp;version=${version}`;","displayNoNewLineWarning":false,"position":86,"left":341,"right":345},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":346,"text":" const response = yield (0, requestUtils_1.retryTypedResponse)('getCacheEntry', () =\u003e __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));","html":" const response = yield (0, requestUtils_1.retryTypedResponse)(\u0026#39;getCacheEntry\u0026#39;, () =\u0026gt; __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));","displayNoNewLineWarning":false,"position":87,"left":342,"right":346},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":347,"text":" // Cache not found","html":" // Cache not found","displayNoNewLineWarning":false,"position":88,"left":343,"right":347},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":348,"text":" if (response.statusCode === 204) {","html":" if (response.statusCode === 204) {","displayNoNewLineWarning":false,"position":89,"left":344,"right":348},{"stylingDirective":null,"type":"HUNK","blobLineNumber":432,"text":"@@ -429,77 +433,92 @@ function getContentRange(start, end) {","html":"@@ -429,77 +433,92 @@ function getContentRange(start, end) {","displayNoNewLineWarning":false,"position":90,"left":428,"right":432},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":433,"text":" // Content-Range: bytes 0-199/*","html":" // Content-Range: bytes 0-199/*","displayNoNewLineWarning":false,"position":91,"left":429,"right":433},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":434,"text":" return `bytes ${start}-${end}/*`;","html":" return `bytes ${start}-${end}/*`;","displayNoNewLineWarning":false,"position":92,"left":430,"right":434},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":435,"text":" }","html":" }","displayNoNewLineWarning":false,"position":93,"left":431,"right":435},{"stylingDirective":null,"type":"DELETION","blobLineNumber":432,"text":"-function uploadChunk(httpClient, resourceUrl, openStream, start, end) {","html":"-function uploadChunk(\u003cspan class=\"x x-first x-last\"\u003ehttpClient, \u003c/span\u003eresourceUrl, openStream, start, end) {","displayNoNewLineWarning":false,"position":94,"left":432,"right":435},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":436,"text":"+function uploadChunk(resourceUrl, openStream, start, end) {","html":"+function uploadChunk(resourceUrl, openStream, start, end) {","displayNoNewLineWarning":false,"position":95,"left":432,"right":436},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":437,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":96,"left":433,"right":437},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":438,"text":" core.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);","html":" core.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);","displayNoNewLineWarning":false,"position":97,"left":434,"right":438},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":439,"text":" const additionalHeaders = {","html":" const additionalHeaders = {","displayNoNewLineWarning":false,"position":98,"left":435,"right":439},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":440,"text":" 'Content-Type': 'application/octet-stream',","html":" \u0026#39;Content-Type\u0026#39;: \u0026#39;application/octet-stream\u0026#39;,","displayNoNewLineWarning":false,"position":99,"left":436,"right":440},{"stylingDirective":null,"type":"DELETION","blobLineNumber":437,"text":"- 'Content-Range': getContentRange(start, end)","html":"- \u0026#39;Content-\u003cspan class=\"x x-first x-last\"\u003eRange\u003c/span\u003e\u0026#39;: \u003cspan class=\"x x-first x-last\"\u003egetContentRange(\u003c/span\u003estart\u003cspan class=\"x x-first x-last\"\u003e, end)\u003c/span\u003e","displayNoNewLineWarning":false,"position":100,"left":437,"right":440},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":441,"text":"+ 'Content-Length': end - start + 1","html":"+ \u0026#39;Content-\u003cspan class=\"x x-first x-last\"\u003eLength\u003c/span\u003e\u0026#39;: \u003cspan class=\"x x-first x-last\"\u003eend - \u003c/span\u003estart\u003cspan class=\"x x-first x-last\"\u003e + 1\u003c/span\u003e","displayNoNewLineWarning":false,"position":101,"left":437,"right":441},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":442,"text":" };","html":" };","displayNoNewLineWarning":false,"position":102,"left":438,"right":442},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":443,"text":"+ const s3HttpClient = new http_client_1.HttpClient('useblacksmith/cache');","html":"+ const s3HttpClient = new http_client_1.HttpClient(\u0026#39;useblacksmith/cache\u0026#39;);","displayNoNewLineWarning":false,"position":103,"left":438,"right":443},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":444,"text":" const uploadChunkResponse = yield (0, requestUtils_1.retryHttpClientResponse)(`uploadChunk (start: ${start}, end: ${end})`, () =\u003e __awaiter(this, void 0, void 0, function* () {","html":" const uploadChunkResponse = yield (0, requestUtils_1.retryHttpClientResponse)(`uploadChunk (start 8000 : ${start}, end: ${end})`, () =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":104,"left":439,"right":444},{"stylingDirective":null,"type":"DELETION","blobLineNumber":440,"text":"- return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);","html":"- return \u003cspan class=\"x x-first x-last\"\u003ehttpClient\u003c/span\u003e.sendStream(\u0026#39;\u003cspan class=\"x x-first x-last\"\u003ePATCH\u003c/span\u003e\u0026#39;, resourceUrl, openStream(), additionalHeaders);","displayNoNewLineWarning":false,"position":105,"left":440,"right":444},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":445,"text":"+ return s3HttpClient.sendStream('PUT', resourceUrl, openStream(), additionalHeaders);","html":"+ return \u003cspan class=\"x x-first x-last\"\u003es3HttpClient\u003c/span\u003e.sendStream(\u0026#39;\u003cspan class=\"x x-first x-last\"\u003ePUT\u003c/span\u003e\u0026#39;, resourceUrl, openStream(), additionalHeaders);","displayNoNewLineWarning":false,"position":106,"left":440,"right":445},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":446,"text":" }));","html":" }));","displayNoNewLineWarning":false,"position":107,"left":441,"right":446},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":447,"text":" if (!(0, requestUtils_1.isSuccessStatusCode)(uploadChunkResponse.message.statusCode)) {","html":" if (!(0, requestUtils_1.isSuccessStatusCode)(uploadChunkResponse.message.statusCode)) {","displayNoNewLineWarning":false,"position":108,"left":442,"right":447},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":448,"text":"+ core.debug(`Upload chunk failed with status message: ${JSON.stringify(uploadChunkResponse.message.statusMessage)}`);","html":"+ core.debug(`Upload chunk failed with status message: ${JSON.stringify(uploadChunkResponse.message.statusMessage)}`);","displayNoNewLineWarning":false,"position":109,"left":442,"right":448},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":449,"text":"+ core.debug(`Upload chunk failed with headers: ${JSON.stringify(uploadChunkResponse.message.headers)}`);","html":"+ core.debug(`Upload chunk failed with headers: ${JSON.stringify(uploadChunkResponse.message.headers)}`);","displayNoNewLineWarning":false,"position":110,"left":442,"right":449},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":450,"text":"+ core.debug(`Upload chunk failed with response body: ${yield uploadChunkResponse.readBody()}`);","html":"+ core.debug(`Upload chunk failed with response body: ${yield uploadChunkResponse.readBody()}`);","displayNoNewLineWarning":false,"position":111,"left":442,"right":450},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":451,"text":" throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);","html":" throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);","displayNoNewLineWarning":false,"position":112,"left":443,"right":451},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":452,"text":" }","html":" }","displayNoNewLineWarning":false,"position":113,"left":444,"right":452},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":453,"text":"+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion","html":"+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion","displayNoNewLineWarning":false,"position":114,"left":444,"right":453},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":454,"text":"+ return uploadChunkResponse.message.headers.etag;","html":"+ return uploadChunkResponse.message.headers.etag;","displayNoNewLineWarning":false,"position":115,"left":444,"right":454},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":455,"text":" });","html":" });","displayNoNewLineWarning":false,"position":116,"left":445,"right":455},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":456,"text":" }","html":" }","displayNoNewLineWarning":false,"position":117,"left":446,"right":456},{"stylingDirective":null,"type":"DELETION","blobLineNumber":447,"text":"-function uploadFile(httpClient, cacheId, archivePath, options) {","html":"-function uploadFile(\u003cspan class=\"x x-first x-last\"\u003ehttpClient, cacheId, \u003c/span\u003earchivePath, \u003cspan class=\"x x-first x-last\"\u003eoptions\u003c/span\u003e) {","displayNoNewLineWarning":false,"position":118,"left":447,"right":456},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":457,"text":"+function uploadFile(archivePath, urls) {","html":"+function uploadFile(archivePath, \u003cspan class=\"x x-first x-last\"\u003eurls\u003c/span\u003e) {","displayNoNewLineWarning":false,"position":119,"left":447,"right":457},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":458,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":120,"left":448,"right":458},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":459,"text":" // Upload Chunks","html":" // Upload Chunks","displayNoNewLineWarning":false,"position":121,"left":449,"right":459},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":460,"text":"+ core.debug(`archivePath: ${archivePath}`);","html":"+ core.debug(`archivePath: ${archivePath}`);","displayNoNewLineWarning":false,"position":122,"left":449,"right":460},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":461,"text":" const fileSize = utils.getArchiveFileSizeInBytes(archivePath);","html":" const fileSize = utils.getArchiveFileSizeInBytes(archivePath);","displayNoNewLineWarning":false,"position":123,"left":450,"right":461},{"stylingDirective":null,"type":"DELETION","blobLineNumber":451,"text":"- const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);","html":"- const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);","displayNoNewLineWarning":false,"position":124,"left":451,"right":461},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":462,"text":" const fd = fs.openSync(archivePath, 'r');","html":" const fd = fs.openSync(archivePath, \u0026#39;r\u0026#39;);","displayNoNewLineWarning":false,"position":125,"left":452,"right":462},{"stylingDirective":null,"type":"DELETION","blobLineNumber":453,"text":"- const uploadOptions = (0, options_1.getUploadOptions)(options);","html":"- const uploadOptions = (0, options_1.getUploadOptions)(options);","displayNoNewLineWarning":false,"position":126,"left":453,"right":462},{"stylingDirective":null,"type":"DELETION","blobLineNumber":454,"text":"- const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);","html":"- const concurrency = utils.assertDefined(\u0026#39;uploadConcurrency\u0026#39;, uploadOptions.uploadConcurrency);","displayNoNewLineWarning":false,"position":127,"left":454,"right":462},{"stylingDirective":null,"type":"DELETION","blobLineNumber":455,"text":"- const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);","html":"- const maxChunkSize = utils.assertDefined(\u0026#39;uploadChunkSize\u0026#39;, uploadOptions.uploadChunkSize);","displayNoNewLineWarning":false,"position":128,"left":455,"right":462},{"stylingDirective":null,"type":"DELETION","blobLineNumber":456,"text":"- const parallelUploads = [...new Array(concurrency).keys()];","html":"- const parallelUploads = [...new Array(concurrency).keys()];","displayNoNewLineWarning":false,"position":129,"left":456,"right":462},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":463,"text":"+ const maxChunkSize = 25 * 1024 * 1024; // Matches the chunkSize in our cache service.","html":"+ const maxChunkSize = 25 * 1024 * 1024; // Matches the chunkSize in our cache service.","displayNoNewLineWarning":false,"position":130,"left":456,"right":463},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":464,"text":" core.debug('Awaiting all uploads');","html":" core.debug(\u0026#39;Awaiting all uploads\u0026#39;);","displayNoNewLineWarning":false,"position":131,"left":457,"right":464},{"stylingDirective":null,"type":"DELETION","blobLineNumber":458,"text":"- let offset = 0;","html":"- let \u003cspan class=\"x x-first x-last\"\u003eoffset\u003c/span\u003e = \u003cspan class=\"x x-first x-last\"\u003e0\u003c/span\u003e;","displayNoNewLineWarning":false,"position":132,"left":458,"right":464},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":465,"text":"+ let eTags = [];","html":"+ let \u003cspan class=\"x x-first x-last\"\u003eeTags\u003c/span\u003e = \u003cspan class=\"x x-first x-last\"\u003e[]\u003c/span\u003e;","displayNoNewLineWarning":false,"position":133,"left":458,"right":465},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":466,"text":" try {","html":" try {","displayNoNewLineWarning":false,"position":134,"left":459,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":460,"text":"- yield Promise.all(parallelUploads.map(() =\u003e __awaiter(this, void 0, void 0, function* () {","html":"- yield Promise.all(parallelUploads.map(() =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":135,"left":460,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":461,"text":"- while (offset \u003c fileSize) {","html":"- while (offset \u0026lt; fileSize) {","displayNoNewLineWarning":false,"position":136,"left":461,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":462,"text":"- const chunkSize = Math.min(fileSize - offset, maxChunkSize);","html":"- const chunkSize = Math.min(fileSize - offset, maxChunkSize);","displayNoNewLineWarning":false,"position":137,"left":462,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":463,"text":"- const start = offset;","html":"- const start = offset;","displayNoNewLineWarning":false,"position":138,"left":463,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":464,"text":"- const end = offset + chunkSize - 1;","html":"- const end = offset + chunkSize - 1;","displayNoNewLineWarning":false,"position":139,"left":464,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":465,"text":"- offset += maxChunkSize;","html":"- offset += maxChunkSize;","displayNoNewLineWarning":false,"position":140,"left":465,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":466,"text":"- yield uploadChunk(httpClient, resourceUrl, () =\u003e fs","html":"- yield uploadChunk(httpClient, resourceUrl, () =\u0026gt; fs","displayNoNewLineWarning":false,"position":141,"left":466,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":467,"text":"- .createReadStream(archivePath, {","html":"- .createReadStream(archivePath, {","displayNoNewLineWarning":false,"position":142,"left":467,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":468,"text":"- fd,","html":"- fd,","displayNoNewLineWarning":false,"position":143,"left":468,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":469,"text":"- start,","html":"- start,","displayNoNewLineWarning":false,"position":144,"left":469,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":470,"text":"- end,","html":"- end,","displayNoNewLineWarning":false,"position":145,"left":470,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":471,"text":"- autoClose: false","html":"- autoClose: false","displayNoNewLineWarning":false,"position":146,"left":471,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":472,"text":"- })","html":"- })","displayNoNewLineWarning":false,"position":147,"left":472,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":473,"text":"- .on('error', error =\u003e {","html":"- .on(\u0026#39;error\u0026#39;, error =\u0026gt; {","displayNoNewLineWarning":false,"position":148,"left":473,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":474,"text":"- throw new Error(`Cache upload failed because file read failed with ${error.message}`);","html":"- throw new Error(`Cache upload failed because file read failed with ${error.message}`);","displayNoNewLineWarning":false,"position":149,"left":474,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":475,"text":"- }), start, end);","html":"- }), start, end);","displayNoNewLineWarning":false,"position":150,"left":475,"right":466},{"stylingDirective":null,"type":"DELETION","blobLineNumber":476,"text":"- }","html":"- }","displayNoNewLineWarning":false,"position":151,"left":476,"right":466},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":467,"text":"+ eTags = yield Promise.all(urls.map((url, index) =\u003e __awaiter(this, void 0, void 0, function* () {","html":"+ eTags = yield Promise.all(urls.map((url, index) =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":152,"left":476,"right":467},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":468,"text":"+ const offset = index * maxChunkSize;","html":"+ const offset = index * maxChunkSize;","displayNoNewLineWarning":false,"position":153,"left":476,"right":468},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":469,"text":"+ const chunkSize = Math.min(fileSize - offset, maxChunkSize);","html":"+ const chunkSize = Math.min(fileSize - offset, maxChunkSize);","displayNoNewLineWarning":false,"position":154,"left":476,"right":469},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":470,"text":"+ const start = offset;","html":"+ const start = offset;","displayNoNewLineWarning":false,"position":155,"left":476,"right":470},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":471,"text":"+ let end = offset + chunkSize - 1;","html":"+ let end = offset + chunkSize - 1;","displayNoNewLineWarning":false,"position":156,"left":476,"right":471},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":472,"text":"+ if (chunkSize !== maxChunkSize) {","html":"+ if (chunkSize !== maxChunkSize) {","displayNoNewLineWarning":false,"position":157,"left":476,"right":472},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":473,"text":"+ end = fileSize - 1;","html":"+ end = fileSize - 1;","displayNoNewLineWarning":false,"position":158,"left":476,"right":473},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":474,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":159,"left":476,"right":474},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":475,"text":"+ core.debug(`Uploading chunk to ${url}: ${start}-${end}/${fileSize}`);","html":"+ core.debug(`Uploading chunk to ${url}: ${start}-${end}/${fileSize}`);","displayNoNewLineWarning":false,"position":160,"left":476,"right":475},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":476,"text":"+ const eTag = yield uploadChunk(url, () =\u003e fs","html":"+ const eTag = yield uploadChunk(url, () =\u0026gt; fs","displayNoNewLineWarning":false,"position":161,"left":476,"right":476},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":477,"text":"+ .createReadStream(archivePath, {","html":"+ .createReadStream(archivePath, {","displayNoNewLineWarning":false,"position":162,"left":476,"right":477},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":478,"text":"+ fd,","html":"+ fd,","displayNoNewLineWarning":false,"position":163,"left":476,"right":478},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":479,"text":"+ start,","html":"+ start,","displayNoNewLineWarning":false,"position":164,"left":476,"right":479},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":480,"text":"+ end,","html":"+ end,","displayNoNewLineWarning":false,"position":165,"left":476,"right":480},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":481,"text":"+ autoClose: false","html":"+ autoClose: false","displayNoNewLineWarning":false,"position":166,"left":476,"right":481},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":482,"text":"+ })","html":"+ })","displayNoNewLineWarning":false,"position":167,"left":476,"right":482},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":483,"text":"+ .on('error', error =\u003e {","html":"+ .on(\u0026#39;error\u0026#39;, error =\u0026gt; {","displayNoNewLineWarning":false,"position":168,"left":476,"right":483},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":484,"text":"+ throw new Error(`Cache upload failed because file read failed with ${error.message}`);","html":"+ throw new Error(`Cache upload failed because file read failed with ${error.message}`);","displayNoNewLineWarning":false,"position":169,"left":476,"right":484},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":485,"text":"+ }), start, end);","html":"+ }), start, end);","displayNoNewLineWarning":false,"position":170,"left":476,"right":485},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":486,"text":"+ core.debug(`Upload to ${url} complete`);","html":"+ core.debug(`Upload to ${url} complete`);","displayNoNewLineWarning":false,"position":171,"left":476,"right":486},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":487,"text":"+ return eTag !== null \u0026\u0026 eTag !== void 0 ? eTag : '';","html":"+ return eTag !== null \u0026amp;\u0026amp; eTag !== void 0 ? eTag : \u0026#39;\u0026#39;;","displayNoNewLineWarning":false,"position":172,"left":476,"right":487},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":488,"text":" })));","html":" })));","displayNoNewLineWarning":false,"position":173,"left":477,"right":488},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":489,"text":" }","html":" }","displayNoNewLineWarning":false,"position":174,"left":478,"right":489},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":490,"text":"+ catch (error) {","html":"+ catch (error) {","displayNoNewLineWarning":false,"position":175,"left":478,"right":490},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":491,"text":"+ core.debug(`Cache upload failed: ${JSON.stringify(error)}`);","html":"+ core.debug(`Cache upload failed: ${JSON.stringify(error)}`);","displayNoNewLineWarning":false,"position":176,"left":478,"right":491},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":492,"text":"+ throw error;","html":"+ throw error;","displayNoNewLineWarning":false,"position":177,"left":478,"right":492},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":493,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":178,"left":478,"right":493},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":494,"text":" finally {","html":" finally {","displayNoNewLineWarning":false,"position":179,"left":479,"right":494},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":495,"text":" fs.closeSync(fd);","html":" fs.closeSync(fd);","displayNoNewLineWarning":false,"position":180,"left":480,"right":495},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":496,"text":" }","html":" }","displayNoNewLineWarning":false,"position":181,"left":481,"right":496},{"stylingDirective":null,"type":"DELETION","blobLineNumber":482,"text":"- return;","html":"- return;","displayNoNewLineWarning":false,"position":182,"left":482,"right":496},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":497,"text":"+ return eTags;","html":"+ return\u003cspan class=\"x x-first x-last\"\u003e eTags\u003c/span\u003e;","displayNoNewLineWarning":false,"position":183,"left":482,"right":497},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":498,"text":" });","html":" });","displayNoNewLineWarning":false,"position":184,"left":483,"right":498},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":499,"text":" }","html":" }","displayNoNewLineWarning":false,"position":185,"left":484,"right":499},{"stylingDirective":null,"type":"DELETION","blobLineNumber":485,"text":"-function commitCache(httpClient, cacheId, filesize) {","html":"-function commitCache(httpClient, cacheId, filesize) {","displayNoNewLineWarning":false,"position":186,"left":485,"right":499},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":500,"text":"+function commitCache(httpClient, cacheId, filesize, eTags, uploadId) {","html":"+function commitCache(httpClient, cacheId, filesize\u003cspan class=\"x x-first x-last\"\u003e, eTags, uploadId\u003c/span\u003e) {","displayNoNewLineWarning":false,"position":187,"left":485,"right":500},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":501,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":188,"left":486,"right":501},{"stylingDirective":null,"type":"DELETION","blobLineNumber":487,"text":"- const commitCacheRequest = { size: filesize };","html":"- const commitCacheRequest = { size: filesize };","displayNoNewLineWarning":false,"position":189,"left":487,"right":501},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":502,"text":"+ const commitCacheRequest = {","html":"+ const commitCacheRequest = {","displayNoNewLineWarning":false,"position":190,"left":487,"right":502},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":503,"text":"+ size: filesize,","html":"+ size: filesize,","displayNoNewLineWarning":false,"position":191,"left":487,"right":503},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":504,"text":"+ eTags,","html":"+ eTags,","displayNoNewLineWarning":false,"position":192,"left":487,"right":504},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":505,"text":"+ uploadId","html":"+ uploadId","displayNoNewLineWarning":false,"position":193,"left":487,"right":505},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":506,"text":"+ };","html":"+ };","displayNoNewLineWarning":false,"position":194,"left":487,"right":506},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":507,"text":" return yield (0, requestUtils_1.retryTypedResponse)('commitCache', () =\u003e __awaiter(this, void 0, void 0, function* () {","html":" return yield (0, requestUtils_1.retryTypedResponse)(\u0026#39;commitCache\u0026#39;, () =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":195,"left":488,"right":507},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":508,"text":" return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);","html":" return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);","displayNoNewLineWarning":false,"position":196,"left":489,"right":508},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":509,"text":" }));","html":" }));","displayNoNewLineWarning":false,"position":197,"left":490,"right":509},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":510,"text":" });","html":" });","displayNoNewLineWarning":false,"position":198,"left":491,"right":510},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":511,"text":" }","html":" }","displayNoNewLineWarning":false,"position":199,"left":492,"right":511},{"stylingDirective":null,"type":"DELETION","blobLineNumber":493,"text":"-function saveCache(cacheId, archivePath, options) {","html":"-function saveCache(cacheId, archivePath, \u003cspan class=\"x x-first x-last\"\u003eoptions\u003c/span\u003e) {","displayNoNewLineWarning":false,"position":200,"left":493,"right":511},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":512,"text":"+function saveCache(cacheId, archivePath, urls, uploadId) {","html":"+function saveCache(cacheId, archivePath, \u003cspan class=\"x x-first x-last\"\u003eurls, uploadId\u003c/span\u003e) {","displayNoNewLineWarning":false,"position":201,"left":493,"right":512},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":513,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":202,"left":494,"right":513},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":514,"text":" const httpClient = createHttpClient();","html":" const httpClient = createHttpClient();","displayNoNewLineWarning":false,"position":203,"left":495,"right":514},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":515,"text":" core.debug('Upload cache');","html":" core.debug(\u0026#39;Upload cache\u0026#39;);","displayNoNewLineWarning":false,"position":204,"left":496,"right":515},{"stylingDirective":null,"type":"DELETION","blobLineNumber":497,"text":"- yield uploadFile(httpClient, cacheId, archivePath, options);","html":"- yield uploadFile(\u003cspan class=\"x x-first x-last\"\u003ehttpClient, cacheId, \u003c/span\u003earchivePath, \u003cspan class=\"x x-first x-last\"\u003eoptions\u003c/span\u003e);","displayNoNewLineWarning":false,"position":205,"left":497,"right":515},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":516,"text":"+ const eTags = yield uploadFile(archivePath, urls);","html":"+ \u003cspan class=\"x x-first x-last\"\u003econst eTags = \u003c/span\u003eyield uploadFile(archivePath, \u003cspan class=\"x x-first x-last\"\u003eurls\u003c/span\u003e);","displayNoNewLineWarning":false,"position":206,"left":497,"right":516},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":517,"text":" // Commit Cache","html":" // Commit Cache","displayNoNewLineWarning":false,"position":207,"left":498,"right":517},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":518,"text":" core.debug('Commiting cache');","html":" core.debug(\u0026#39;Commiting cache\u0026#39;);","displayNoNewLineWarning":false,"position":208,"left":499,"right":518},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":519,"text":" const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);","html":" const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);","displayNoNewLineWarning":false,"position":209,"left":500,"right":519},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":520,"text":" core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);","html":" core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);","displayNoNewLineWarning":false,"position":210,"left":501,"right":520},{"stylingDirective":null,"type":"DELETION","blobLineNumber":502,"text":"- const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);","html":"- const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);","displayNoNewLineWarning":false,"position":211,"left":502,"right":520},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":521,"text":"+ const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize, eTags, uploadId);","html":"+ const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize\u003cspan class=\"x x-first x-last\"\u003e, eTags, uploadId\u003c/span\u003e);","displayNoNewLineWarning":false,"position":212,"left":502,"right":521},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":522,"text":" if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) {","html":" if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) {","displayNoNewLineWarning":false,"position":213,"left":503,"right":522},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":523,"text":" throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);","html":" throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);","displayNoNewLineWarning":false,"position":214,"left":504,"right":523},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":524,"text":" }","html":" }","displayNoNewLineWarning":false,"position":215,"left":505,"right":524},{"stylingDirective":null,"type":"HUNK","blobLineNumber":825,"text":"@@ -807,7 +826,6 @@ const buffer = __importStar(__nccwpck_require__(4300));","html":"@@ -807,7 +826,6 @@ const buffer = __importStar(__nccwpck_require__(4300));","displayNoNewLineWarning":false,"position":216,"left":806,"right":825},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":826,"text":" const fs = __importStar(__nccwpck_require__(7147));","html":" const fs = __importStar(__nccwpck_require__(7147));","displayNoNewLineWarning":false,"position":217,"left":807,"right":826},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":827,"text":" const stream = __importStar(__nccwpck_require__(2781));","html":" const stream = __importStar(__nccwpck_require__(2781));","displayNoNewLineWarning":false,"position":218,"left":808,"right":827},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":828,"text":" const util = __importStar(__nccwpck_require__(3837));","html":" const util = __importStar(__nccwpck_require__(3837));","displayNoNewLineWarning":false,"position":219,"left":809,"right":828},{"stylingDirective":null,"type":"DELETION","blobLineNumber":810,"text":"-const utils = __importStar(__nccwpck_require__(1518));","html":"-const utils = __importStar(__nccwpck_require__(1518));","displayNoNewLineWarning":false,"position":220,"left":810,"right":828},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":829,"text":" const constants_1 = __nccwpck_require__(8840);","html":" const constants_1 = __nccwpck_require__(8840);","displayNoNewLineWarning":false,"position":221,"left":811,"right":829},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":830,"text":" const requestUtils_1 = __nccwpck_require__(3981);","html":" const requestUtils_1 = __nccwpck_require__(3981);","displayNoNewLineWarning":false,"position":222,"left":812,"right":830},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":831,"text":" const abort_controller_1 = __nccwpck_require__(2557);","html":" const abort_controller_1 = __nccwpck_require__(2557);","displayNoNewLineWarning":false,"position":223,"left":813,"right":831},{"stylingDirective":null,"type":"HUNK","blobLineNumber":834,"text":"@@ -817,10 +835,19 @@ const abort_controller_1 = __nccwpck_require__(2557);","html":"@@ -817,10 +835,19 @@ const abort_controller_1 = __nccwpck_require__(2557);","displayNoNewLineWarning":false,"position" 8000 :224,"left":816,"right":834},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":835,"text":" * @param response the HTTP response","html":" * @param response the HTTP response","displayNoNewLineWarning":false,"position":225,"left":817,"right":835},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":836,"text":" * @param output the writable stream","html":" * @param output the writable stream","displayNoNewLineWarning":false,"position":226,"left":818,"right":836},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":837,"text":" */","html":" */","displayNoNewLineWarning":false,"position":227,"left":819,"right":837},{"stylingDirective":null,"type":"DELETION","blobLineNumber":820,"text":"-function pipeResponseToStream(response, output) {","html":"-function pipeResponseToStream(response, output) {","displayNoNewLineWarning":false,"position":228,"left":820,"right":837},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":838,"text":"+function pipeResponseToStream(response, output, progress) {","html":"+function pipeResponseToStream(response, output\u003cspan class=\"x x-first x-last\"\u003e, progress\u003c/span\u003e) {","displayNoNewLineWarning":false,"position":229,"left":820,"right":838},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":839,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":230,"left":821,"right":839},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":840,"text":" const pipeline = util.promisify(stream.pipeline);","html":" const pipeline = util.promisify(stream.pipeline);","displayNoNewLineWarning":false,"position":231,"left":822,"right":840},{"stylingDirective":null,"type":"DELETION","blobLineNumber":823,"text":"- yield pipeline(response.message, output);","html":"- yield pipeline(response.message, output);","displayNoNewLineWarning":false,"position":232,"left":823,"right":840},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":841,"text":"+ const reportProgress = new stream.Transform({","html":"+ const reportProgress = new stream.Transform({","displayNoNewLineWarning":false,"position":233,"left":823,"right":841},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":842,"text":"+ transform(chunk, _encoding, callback) {","html":"+ transform(chunk, _encoding, callback) {","displayNoNewLineWarning":false,"position":234,"left":823,"right":842},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":843,"text":"+ if (progress) {","html":"+ if (progress) {","displayNoNewLineWarning":false,"position":235,"left":823,"right":843},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":844,"text":"+ progress.setReceivedBytes(progress.getTransferredBytes() + chunk.length);","html":"+ progress.setReceivedBytes(progress.getTransferredBytes() + chunk.length);","displayNoNewLineWarning":false,"position":236,"left":823,"right":844},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":845,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":237,"left":823,"right":845},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":846,"text":"+ this.push(chunk);","html":"+ this.push(chunk);","displayNoNewLineWarning":false,"position":238,"left":823,"right":846},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":847,"text":"+ callback();","html":"+ callback();","displayNoNewLineWarning":false,"position":239,"left":823,"right":847},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":848,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":240,"left":823,"right":848},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":849,"text":"+ });","html":"+ });","displayNoNewLineWarning":false,"position":241,"left":823,"right":849},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":850,"text":"+ yield pipeline(response.message, reportProgress, output);","html":"+ yield pipeline(response.message, reportProgress, output);","displayNoNewLineWarning":false,"position":242,"left":823,"right":850},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":851,"text":" });","html":" });","displayNoNewLineWarning":false,"position":243,"left":824,"right":851},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":852,"text":" }","html":" }","displayNoNewLineWarning":false,"position":244,"left":825,"right":852},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":853,"text":" /**","html":" /**","displayNoNewLineWarning":false,"position":245,"left":826,"right":853},{"stylingDirective":null,"type":"HUNK","blobLineNumber":958,"text":"@@ -932,26 +959,67 @@ exports.DownloadProgress = DownloadProgress;","html":"@@ -932,26 +959,67 @@ exports.DownloadProgress = DownloadProgress;","displayNoNewLineWarning":false,"position":246,"left":931,"right":958},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":959,"text":" */","html":" */","displayNoNewLineWarning":false,"position":247,"left":932,"right":959},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":960,"text":" function downloadCacheHttpClient(archiveLocation, archivePath) {","html":" function downloadCacheHttpClient(archiveLocation, archivePath) {","displayNoNewLineWarning":false,"position":248,"left":933,"right":960},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":961,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":249,"left":934,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":935,"text":"- const writeStream = fs.createWriteStream(archivePath);","html":"- const writeStream = fs.createWriteStream(archivePath);","displayNoNewLineWarning":false,"position":250,"left":935,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":936,"text":"- const httpClient = new http_client_1.HttpClient('actions/cache');","html":"- const httpClient = new http_client_1.HttpClient(\u0026#39;actions/cache\u0026#39;);","displayNoNewLineWarning":false,"position":251,"left":936,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":937,"text":"- const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () =\u003e __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));","html":"- const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)(\u0026#39;downloadCache\u0026#39;, () =\u0026gt; __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));","displayNoNewLineWarning":false,"position":252,"left":937,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":938,"text":"- // Abort download if no traffic received over the socket.","html":"- // Abort download if no traffic received over the socket.","displayNoNewLineWarning":false,"position":253,"left":938,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":939,"text":"- downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () =\u003e {","html":"- downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () =\u0026gt; {","displayNoNewLineWarning":false,"position":254,"left":939,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":940,"text":"- downloadResponse.message.destroy();","html":"- downloadResponse.message.destroy();","displayNoNewLineWarning":false,"position":255,"left":940,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":941,"text":"- core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);","html":"- core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);","displayNoNewLineWarning":false,"position":256,"left":941,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":942,"text":"- });","html":"- });","displayNoNewLineWarning":false,"position":257,"left":942,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":943,"text":"- yield pipeResponseToStream(downloadResponse, writeStream);","html":"- yield pipeResponseToStream(downloadResponse, writeStream);","displayNoNewLineWarning":false,"position":258,"left":943,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":944,"text":"- // Validate download size.","html":"- // Validate download size.","displayNoNewLineWarning":false,"position":259,"left":944,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":945,"text":"- const contentLengthHeader = downloadResponse.message.headers['content-length'];","html":"- const contentLengthHeader = downloadResponse.message.headers[\u0026#39;content-length\u0026#39;];","displayNoNewLineWarning":false,"position":260,"left":945,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":946,"text":"- if (contentLengthHeader) {","html":"- if (contentLengthHeader) {","displayNoNewLineWarning":false,"position":261,"left":946,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":947,"text":"- const expectedLength = parseInt(contentLengthHeader);","html":"- const expectedLength = parseInt(contentLengthHeader);","displayNoNewLineWarning":false,"position":262,"left":947,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":948,"text":"- const actualLength = utils.getArchiveFileSizeInBytes(archivePath);","html":"- const actualLength = utils.getArchiveFileSizeInBytes(archivePath);","displayNoNewLineWarning":false,"position":263,"left":948,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":949,"text":"- if (actualLength !== expectedLength) {","html":"- if (actualLength !== expectedLength) {","displayNoNewLineWarning":false,"position":264,"left":949,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":950,"text":"- throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);","html":"- throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);","displayNoNewLineWarning":false,"position":265,"left":950,"right":961},{"stylingDirective":null,"type":"DELETION","blobLineNumber":951,"text":"- }","html":"- }","displayNoNewLineWarning":false,"position":266,"left":951,"right":961},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":962,"text":"+ const CONCURRENCY = 8;","html":"+ const CONCURRENCY = 8;","displayNoNewLineWarning":false,"position":267,"left":951,"right":962},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":963,"text":"+ const fdesc = yield fs.promises.open(archivePath, 'w+');","html":"+ const fdesc = yield fs.promises.open(archivePath, \u0026#39;w+\u0026#39;);","displayNoNewLineWarning":false,"position":268,"left":951,"right":963},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":964,"text":"+ // Set file permissions so that other users can untar the cache","html":"+ // Set file permissions so that other users can untar the cache","displayNoNewLineWarning":false,"position":269,"left":951,"right":964},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":965,"text":"+ yield fdesc.chmod(0o644);","html":"+ yield fdesc.chmod(0o644);","displayNoNewLineWarning":false,"position":270,"left":951,"right":965},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":966,"text":"+ let progressLogger;","html":"+ let progressLogger;","displayNoNewLineWarning":false,"position":271,"left":951,"right":966},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":967,"text":"+ try {","html":"+ try {","displayNoNewLineWarning":false,"position":272,"left":951,"right":967},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":968,"text":"+ core.debug(`Downloading from ${archiveLocation} to ${archivePath}`);","html":"+ core.debug(`Downloading from ${archiveLocation} to ${archivePath}`);","displayNoNewLineWarning":false,"position":273,"left":951,"right":968},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":969,"text":"+ const httpClient = new http_client_1.HttpClient('useblacksmith/cache');","html":"+ const httpClient = new http_client_1.HttpClient(\u0026#39;useblacksmith/cache\u0026#39;);","displayNoNewLineWarning":false,"position":274,"left":951,"right":969},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":970,"text":"+ const metadataResponse = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () =\u003e __awaiter(this, void 0, void 0, function* () {","html":"+ const metadataResponse = yield (0, requestUtils_1.retryHttpClientResponse)(\u0026#39;downloadCache\u0026#39;, () =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":275,"left":951,"right":970},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":971,"text":"+ return httpClient.get(archiveLocation, {","html":"+ return httpClient.get(archiveLocation, {","displayNoNewLineWarning":false,"position":276,"left":951,"right":971},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":972,"text":"+ Range: 'bytes=0-1'","html":"+ Range: \u0026#39;bytes=0-1\u0026#39;","displayNoNewLineWarning":false,"position":277,"left":951,"right":972},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":973,"text":"+ });","html":"+ });","displayNoNewLineWarning":false,"position":278,"left":951,"right":973},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":974,"text":"+ }));","html":"+ }));","displayNoNewLineWarning":false,"position":279,"left":951,"right":974},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":975,"text":"+ // Abort download if no traffic received over the socket.","html":"+ // Abort download if no traffic received over the socket.","displayNoNewLineWarning":false,"position":280,"left":951,"right":975},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":976,"text":"+ metadataResponse.message.socket.setTimeout(constants_1.SocketTimeout, () =\u003e {","html":"+ metadataResponse.message.socket.setTimeout(constants_1.SocketTimeout, () =\u0026gt; {","displayNoNewLineWarning":false,"position":281,"left":951,"right":976},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":977,"text":"+ metadataResponse.message.destroy();","html":"+ metadataResponse.message.destroy();","displayNoNewLineWarning":false,"position":282,"left":951,"right":977},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":978,"text":"+ core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);","html":"+ core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);","displayNoNewLineWarning":false,"position":283,"left":951,"right":978},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":979,"text":"+ });","html":"+ });","displayNoNewLineWarning":false,"position":284,"left":951,"right":979},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":980,"text":"+ const contentRangeHeader = metadataResponse.message.headers['content-range'];","html":"+ const contentRangeHeader = metadataResponse.message.headers[\u0026#39;content-range\u0026#39;];","displayNoNewLineWarning":false,"position":285,"left":951,"right":980},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":981,"text":"+ if (!contentRangeHeader) {","html":"+ if (!contentRangeHeader) {","displayNoNewLineWarning":false,"position":286,"left":951,"right":981},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":982,"text":"+ throw new Error('Content-Range is not defined; unable to determine file size');","html":"+ throw new Error(\u0026#39;Content-Range is not defined; unable to determine file size\u0026#39;);","displayNoNewLineWarning":false,"position":287,"left":951,"right":982},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":983,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":288,"left":951,"right":983},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":984,"text":"+ // Parse the total file size from the Content-Range header","html":"+ // Parse the total file size from the Content-Range header","displayNoNewLineWarning":false,"position":289,"left":951,"right":984},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":985,"text":"+ const fileSize = parseInt(contentRangeHeader.split('/')[1]);","html":"+ const fileSize = parseInt(contentRangeHeader.split(\u0026#39;/\u0026#39;)[1]);","displayNoNewLineWarning":false,"position":290,"left":951,"right":985},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":986,"text":"+ if (isNaN(fileSize)) {","html":"+ if (isNaN(fileSize)) {","displayNoNewLineWarning":false,"position":291,"left":951,"right":986},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":987,"text":"+ throw new Error(`Content-Range is not a number; unable to determine file size: ${contentRangeHeader}`);","html":"+ throw new Error(`Content-Range is not a number; unable to determine file size: ${contentRangeHeader}`);","displayNoNewLineWarning":false,"position":292,"left":951,"right":987},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":988,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":293,"left":951,"right":988},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":989,"text":"+ core.debug(`fileSize: ${fileSize}`);","html":"+ core.debug(`fileSize: ${fileSize}`);","displayNoNewLineWarning":false,"position":294,"left":951,"right":989},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":990,"text":"+ // Truncate the file to the correct size","html":"+ // Truncate the file to the correct size","displayNoNewLineWarning":false,"position":295,"left":951,"right":990},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":991,"text":"+ yield fdesc.truncate(fileSize);","html":"+ yield fdesc.truncate(fileSize);","displayNoNewLineWarning":false,"position":296,"left":951,"right":991},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":992,"text":"+ yield fdesc.sync();","html":"+ yield fdesc.sync();","displayNoNewLineWarning":false,"position":297,"left":951,"right":992},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":993,"text":"+ progressLogger = new DownloadProgress(fileSize);","html":"+ progressLogger = new DownloadProgress(fileSize);","displayNoNewLineWarning":false,"position":298,"left":951,"right":993},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":994,"text":"+ progressLogger.startDisplayTimer();","html":"+ progressLogger.startDisplayTimer();","displayNoNewLineWarning":false,"position":299,"left":951,"right":994},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":995,"text":"+ // Divvy up the download into chunks based on CONCURRENCY","html":"+ // Divvy up the download into chunks based on CONCURRENCY","displayNoNewLineWarning":false,"position":300,"left":951,"right":995},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":996,"text":"+ const chunkSize = Math.ceil(fileSize / CONCURRENCY);","html":"+ const chunkSize = Math.ceil(fileSize / CONCURRENCY);","displayNoNewLineWarning":false,"position":301,"left":951,"right":996},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":997,"text":"+ const chunkRanges = [];","html":"+ const chunkRanges = [];","displayNoNewLineWarning":false,"position":302,"left":951,"right":997},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":998,"text":"+ for (let i = 0; i \u003c CONCURRENCY; i++) {","html":"+ for (let i = 0; i \u0026lt; CONCURRENCY; i++) {","displayNoNewLineWarning":false,"position":303,"left":951,"right":998},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":999,"text":"+ const start = i * chunkSize;","html":"+ const start = i * chunkSize;","displayNoNewLineWarning":false,"position":304,"left":951,"right":999},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1000,"text":"+ const end = i === CONCURRENCY - 1 ? fileSize - 1 : (i + 1) * chunkSize - 1;","html":"+ const end = i === CONCURRENCY - 1 ? fileSize - 1 : (i + 1) * chunkSize - 1;","displayNoNewLineWarning":false,"position":305,"left":951,"right":1000},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1001,"text":"+ chunkRanges.push(`bytes=${start}-${end}`);","html":"+ chunkRanges.push(`bytes=${start}-${end}`);","displayNoNewLineWarning":false,"position":306,"left":951,"right":1001},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1002,"text":"+ }","html":"+ }","displayNoNewLineWarning":false,"position":307,"left":951,"right":1002},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1003,"text":"+ const downloads = chunkRanges.map((range) =\u003e __awaiter(this, void 0, void 0, function* () {","html":"+ const downloads = chunkRanges.map((range) =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":308,"left":951,"right":1003},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1004,"text":"+ core.debug(`Downloading range: ${range}`);","html":"+ core.debug(`Downloading range: ${range}`);","displayNoNewLineWarning":false,"position":309,"left":951,"right":1004},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1005,"text":"+ const response = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () =\u003e __awaiter(this, void 0, void 0, function* () {","html":"+ const response = yield (0, requestUtils_1.retryHttpClientResponse)(\u0026#39;downloadCache\u0026#39;, () =\u0026gt; __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":310,"left":951,"right":1005},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1006,"text":"+ return httpClient.get(archiveLocation, {","html":"+ return httpClient.get(archiveLocation, {","displayNoNewLineWarning":false,"position":311,"left":951,"right":1006},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1007,"text":"+ Range: range","html":"+ Range: range","displayNoNewLineWarning":false,"position":312,"left":951,"right":1007},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1008,"text":"+ });","html":"+ });","displayNoNewLineWarning":false,"position":313,"left":951,"right":1008},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1009,"text":"+ }));","html":"+ }));","displayNoNewLineWarning":false,"position":314,"left":951,"right":1009},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1010,"text":"+ const writeStream = fs.createWriteStream(archivePath, {","html":"+ const writeStream = fs.createWriteStream(archivePath, {","displayNoNewLineWarning":false,"position":315,"left":951,"right":1010},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1011,"text":"+ fd: fdesc.fd,","html":"+ fd: fdesc.fd,","displayNoNewLineWarning":false,"position":316,"left":951,"right":1011},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1012,"text":"+ start: parseInt(range.split('=')[1].split('-')[0]),","html":"+ start: parseInt(range.split(\u0026#39;=\u0026#39;)[1].split(\u0026#39;-\u0026#39;)[0]),","displayNoNewLineWarning":false,"position":317,"left":951,"right":1012},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1013,"text":"+ autoClose: false","html":"+ autoClose: false","displayNoNewLineWarning":false,"position":318,"left":951,"right":1013},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1014,"text":"+ });","html":"+ });","displayNoNewLineWarning":false,"position":319,"left":951,"right":1014},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1015,"text":"+ yield pipeResponseToStream(response, writeStream, progressLogger);","html":"+ yield pipeResponseToStream(response, writeStream, progressLogger);","displayNoNewLineWarning":false,"position":320,"left":951,"right":1015},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1016,"text":"+ core.debug(`Finished downloading range: ${range}`);","html":"+ core.debug(`Finished downloading range: ${range}`);","displayNoNewLineWarning":false,"position":321,"left":951,"right":1016},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1017,"text":"+ }));","html":"+ }));","displayNoNewLineWarning":false,"position":322,"left":951,"right":1017},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1018,"text":"+ yield Promise.all(downloads);","html":"+ yield Promise.all(downloads);","displayNoNewLineWarning":false,"position":323,"left":951,"right":1018},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1019,"text":" }","html":" }","displayNoNewLineWarning":false,"position":324,"left":952,"right":1019},{"stylingDirective":null,"type":"DELETION","blobLineNumber":953,"text":"- else {","html":"- else {","displayNoNewLineWarning":false,"position":325,"left":953,"right":1019},{"stylingDirective":null,"type":"DELETION","blobLineNumber":954,"text":"- core.debug('Unable to validate download, no Content-Length header');","html":"- core.debug(\u0026#39;Unable to validate download, no Content-Length header\u0026#39;);","displayNoNewLineWarning":false,"position":326,"left":954,"right":1019},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1020,"text":"+ finally {","html":"+ finally {","displayNoNewLineWarning":false,"position":327,"left":954,"right":1020},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1021,"text":"+ yield fdesc.close();","html":"+ yield fdesc.close();","displayNoNewLineWarning":false,"position":328,"left":954,"right":1021},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1022,"text":"+ progressLogger === null || progressLogger === void 0 ? void 0 : progressLogger.stopDisplayTimer();","html":"+ progressLogger === null || progressLogger === void 0 ? void 0 : progressLogger.stopDisplayTimer();","displayNoNewLineWarning":false,"position":329,"left":954,"right":1022},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1023,"text":" }","html":" }","displayNoNewLineWarning":false,"position":330,"left":955,"right":1023},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1024,"text":" });","html":" });","displayNoNewLineWarning":false,"position":331,"left":956,"right":1024},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1025,"text":" }","html":" }","displayNoNewLineWarning":false,"position":332,"left":957,"right":1025},{"stylingDirective":null,"type":"HUNK","blobLineNumber":1033,"text":"@@ -966,6 +1034,7 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options","html":"@@ -966,6 +1034,7 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options","displayNoNewLineWarning":false,"position":333,"left":965,"right":1033},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1034,"text":" var _a;","html":" var _a;","displayNoNewLineWarning":false,"position":334,"left":966,"right":1034},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1035,"text":" return __awaiter(this, void 0, void 0, function* () {","html":" return __awaiter(this, void 0, void 0, function* () {","displayNoNewLineWarning":false,"position":335,"left":967,"right":1035},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1036,"text":" const archiveDescriptor = yield fs.promises.open(archivePath, 'w');","html":" const archiveDescriptor = yield fs.promises.open(archivePath, \u0026#39;w\u0026#39;);","displayNoNewLineWarning":false,"position":336,"left":968,"right":1036},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1037,"text":"+ core.debug(`Downloading from ${archiveLocation} to ${archivePath}`);","html":"+ core.debug(`Downloading from ${archiveLocation} to ${archivePath}`);","displayNoNewLineWarning":false,"position":337,"left":968,"right":1037},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1038,"text":" const httpClient = new http_client_1.HttpClient('actions/cache', undefined, {","html":" const httpClient = new http_client_1.HttpClient(\u0026#39;actions/cache\u0026#39;, undefined, {","displayNoNewLineWarning":false,"position":338,"left":969,"right":1038},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1039,"text":" socketTimeout: options.timeoutInMs,","html":" socketTimeout: options.timeoutInMs,","displayNoNewLineWarning":false,"position":339,"left":970,"right":1039},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1040,"text":" keepAlive: true","html":" keepAlive: true","displayNoNewLineWarning":false,"position":340,"left":971,"right":1040},{"stylingDirective":null,"type":"HUNK","blobLineNumber":1333,"text":"@@ -1265,6 +1334,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry","html":"@@ -1265,6 +1334,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry","displayNoNewLineWarning":false,"position":341,"left":1264,"right":1333},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1334,"text":" // If the error object contains the statusCode property, extract it and return","html":" // If the error object contains the statusCode property, extract it and return","displayNoNewLineWarning":false,"position":342,"left":1265,"right":1334},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1335,"text":" // an TypedResponse\u003cT\u003e so it can be processed by the retry logic.","html":" // an TypedResponse\u0026lt;T\u0026gt; so it can be processed by the retry logic.","displayNoNewLineWarning":false,"position":343,"left":1266,"right":1335},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1336,"text":" (error) =\u003e {","html":" (error) =\u0026gt; {","displayNoNewLineWarning":false,"position":344,"left":1267,"right":1336},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1337,"text":"+ core.debug(`Error occurred during ${name}: ${JSON.stringify(error)}`);","html":"+ core.debug(`Error occurred during ${name}: ${JSON.stringify(error)}`);","displayNoNewLineWarning":false,"position":345,"left":1267,"right":1337},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1338,"text":" if (error instanceof http_client_1.HttpClientError) {","html":" if (error instanceof http_client_1.HttpClientError) {","displayNoNewLineWarning":false,"position":346,"left":1268,"right":1338},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1339,"text":" return {","html":" 8000 return {","displayNoNewLineWarning":false,"position":347,"left":1269,"right":1339},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1340,"text":" statusCode: error.statusCode,","html":" statusCode: error.statusCode,","displayNoNewLineWarning":false,"position":348,"left":1270,"right":1340},{"stylingDirective":null,"type":"HUNK","blobLineNumber":1701,"text":"@@ -1632,7 +1702,7 @@ function getDownloadOptions(copy) {","html":"@@ -1632,7 +1702,7 @@ function getDownloadOptions(copy) {","displayNoNewLineWarning":false,"position":349,"left":1631,"right":1701},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1702,"text":" const result = {","html":" const result = {","displayNoNewLineWarning":false,"position":350,"left":1632,"right":1702},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1703,"text":" useAzureSdk: false,","html":" useAzureSdk: false,","displayNoNewLineWarning":false,"position":351,"left":1633,"right":1703},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1704,"text":" concurrentBlobDownloads: true,","html":" concurrentBlobDownloads: true,","displayNoNewLineWarning":false,"position":352,"left":1634,"right":1704},{"stylingDirective":null,"type":"DELETION","blobLineNumber":1635,"text":"- downloadConcurrency: 8,","html":"- downloadConcurrency: \u003cspan class=\"x x-first x-last\"\u003e8\u003c/span\u003e,","displayNoNewLineWarning":false,"position":353,"left":1635,"right":1704},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":1705,"text":"+ downloadConcurrency: 10,","html":"+ downloadConcurrency: \u003cspan class=\"x x-first x-last\"\u003e10\u003c/span\u003e,","displayNoNewLineWarning":false,"position":354,"left":1635,"right":1705},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1706,"text":" timeoutInMs: 30000,","html":" timeoutInMs: 30000,","displayNoNewLineWarning":false,"position":355,"left":1636,"right":1706},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1707,"text":" segmentTimeoutInMs: 600000,","html":" segmentTimeoutInMs: 600000,","displayNoNewLineWarning":false,"position":356,"left":1637,"right":1707},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":1708,"text":" lookupOnly: false","html":" lookupOnly: false","displayNoNewLineWarning":false,"position":357,"left":1638,"right":1708}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":82547,"linesChanged":206,"newTreeEntry":{"lineCount":82547,"path":"dist/cache-save/index.js","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"dist/cache-save/index.js","mode":100644},"linesAdded":138,"linesDeleted":68,"path":"dist/cache-save/index.js","pathDigest":"a379c78cfaaf58cfb78a676b1d4e4fc89d0ee6a6304b02f3290a66cb29a60e1a","status":"MODIFIED","truncatedReason":null,"oldOid":"871daa956ca9ea99f3c3e30acb424b7960676734","newOid":"d9e68a44980b864e1f088af6a825652367d0abfa","copilotChatReference":null,"deletedSha":"871daa956ca9ea99f3c3e30acb424b7960676734","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null},{"path":"dist/setup/index.js","pathDigest":"8164d45a0a98040cbf5161c5b6e696920163460bea5f24100a7a01720c4a9a91","status":"MODIFIED"},{"path":"package-lock.json","pathDigest":"053150b640a7ce75eff69d1a22cae7f0f94ad64ce9a855db544dda0929316519","status":"MODIFIED"},{"path":"package.json","pathDigest":"7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519","status":"MODIFIED"}],"splitViewPreference":"unified","ignoreWhitespace":false,"commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/useblacksmith/setup-python/commit/d9e68a44980b864e1f088af6a825652367d0abfa","fileTreeExpanded":true,"headerInfo":{"additions":282,"deletions":141,"filesChanged":4,"filesChangedString":"4"},"moreDiffsToLoad":true,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":20220,"lineShownCount":358},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"hvdB7ZQLiWyPvwY5p7FOWEszzEFXN147-BA69BXRZN8P856-Kf-GlefMw8OhsO1YvskSAfB8CpZeX_Zo8uCVaA"},"/users/diffview?diff=unified":{"post":"AaLJCFR2w5IQdKGP5N1z4_qaY1tRxF9x1adey-k2kjCIphZb6YLMa3gHZHXi3NDjD2C9G_aPC9xz6JJXDgdjhw"},"/notifications/thread":{"post":"76ZoMc7872Pj7vox5FrgGXtY-7UjC1HdTMiv5sni4gVHPdaqdTcXcjuO7hbnA_RTu8IY7wP-ahjC2ysnEAEQpQ"}}},"title":"*: switch use-python to use blacksmith cache · useblacksmith/setup-python@d9e68a4","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-6dcb06aa9fad.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false}}}

Commit d9e68a4

Browse files
committed
*: switch use-python to use blacksmith cache
1 parent 871daa9 commit d9e68a4

File tree

4 files changed

+282
-141
lines changed

4 files changed

+282
-141
lines changed

dist/cache-save/index.js

Lines changed: 138 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ exports.restoreCache = restoreCache;
169169
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
170170
*/
171171
function saveCache(paths, key, options, enableCrossOsArchive = false) {
172-
var _a, _b, _c, _d, _e;
172+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
173173
return __awaiter(this, void 0, void 0, function* () {
174174
checkPaths(paths);
175175
checkKey(key);
@@ -189,12 +189,12 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
189189
if (core.isDebug()) {
190190
yield (0, tar_1.listTar)(archivePath, compressionMethod);
191191
}
192-
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
192+
const fileSizeLimit = 25 * 1024 * 1024 * 1024; // 25GB per repo limit
193193
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
194194
core.debug(`File Size: ${archiveFileSize}`);
195195
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
196196
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
197-
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
197+
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 25GB limit, not saving cache.`);
198198
}
199199
core.debug('Reserving Cache');
200200
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
@@ -212,7 +212,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
212212
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
213213
}
214214
core.debug(`Saving Cache (ID: ${cacheId})`);
215-
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
215+
yield cacheHttpClient.saveCache(cacheId, archivePath, (_g = (_f = reserveCacheResponse.result) === null || _f === void 0 ? void 0 : _f.uploadUrls) !== null && _g !== void 0 ? _g : [], (_j = (_h = reserveCacheResponse.result) === null || _h === void 0 ? void 0 : _h.uploadId) !== null && _j !== void 0 ? _j : '');
216216
}
217217
catch (error) {
218218
const typedError = error;
@@ -221,6 +221,7 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
221221
}
222222
else if (typedError.name === ReserveCacheError.name) {
223223
core.info(`Failed to save: ${typedError.message}`);
224+
core.debug(JSON.stringify(error));
224225
}
225226
else {
226227
core.warning(`Failed to save: ${typedError.message}`);
@@ -294,29 +295,32 @@ const options_1 = __nccwpck_require__(6215);
294295
const requestUtils_1 = __nccwpck_require__(3981);
295296
const versionSalt = '1.0';
296297
function getCacheApiUrl(resource) {
297-
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
298+
const baseUrl = process.env['BLACKSMITH_CACHE_URL'] || 'https://api.blacksmith.sh/cache';
298299
if (!baseUrl) {
299300
throw new Error('Cache Service Url not found, unable to restore cache.');
300301
}
301-
const url = `${baseUrl}_apis/artifactcache/${resource}`;
302-
core.debug(`Resource Url: ${url}`);
302+
const url = `${baseUrl}/${resource}`;
303+
core.debug(`Blacksmith cache resource URL: ${url}; version: 3.2.40`);
303304
return url;
304305
}
305306
function createAcceptHeader(type, apiVersion) {
306307
return `${type};api-version=${apiVersion}`;
307308
}
308309
function getRequestOptions() {
310+
core.debug(`Setting GITHUB_REPO_NAME: ${process.env['GITHUB_REPO_NAME']}`);
309311
const requestOptions = {
310312
headers: {
311-
Accept: createAcceptHeader('application/json', '6.0-preview.1')
313+
Accept: createAcceptHeader('application/json', '6.0-preview.1'),
314+
'X-Github-Repo-Name': process.env['GITHUB_REPO_NAME']
312315
}
313316
};
314317
return requestOptions;
315318
}
316319
function createHttpClient() {
317-
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
318-
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
319-
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
320+
const token = process.env['BLACKSMITH_CACHE_TOKEN'];
321+
core.debug(`BLACKSMITH_CACHE_TOKEN: ${token}`);
322+
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token !== null && token !== void 0 ? token : '');
323+
return new http_client_1.HttpClient('useblacksmith/cache', [bearerCredentialHandler], getRequestOptions());
320324
}
321325
function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) {
322326
const components = paths;
@@ -338,7 +342,7 @@ function getCacheEntry(keys, paths, options) {
338342
return __awaiter(this, void 0, void 0, function* () {
339343
const httpClient = createHttpClient();
340344
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod, options === null || options === void 0 ? void 0 : options.enableCrossOsArchive);
341-
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
345+
const resource = `?keys=${encodeURIComponent(keys.join(','))}&version=${version}`;
342346
const response = yield (0, requestUtils_1.retryTypedResponse)('getCacheEntry', () => __awaiter(this, void 0, void 0, function* () { return httpClient.getJson(getCacheApiUrl(resource)); }));
343347
// Cache not found
344348
if (response.statusCode === 204) {
@@ -429,77 +433,92 @@ function getContentRange(start, end) {
429433
// Content-Range: bytes 0-199/*
430434
return `bytes ${start}-${end}/*`;
431435
}
432-
function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
436+
function uploadChunk(resourceUrl, openStream, start, end) {
433437
return __awaiter(this, void 0, void 0, function* () {
434438
core.debug(`Uploading chunk of size ${end - start + 1} bytes at offset ${start} with content range: ${getContentRange(start, end)}`);
435439
const additionalHeaders = {
436440
'Content-Type': 'application/octet-stream',
437-
'Content-Range': getContentRange(start, end)
441+
'Content-Length': end - start + 1
438442
};
443+
const s3HttpClient = new http_client_1.HttpClient('useblacksmith/cache');
439444
const uploadChunkResponse = yield (0, requestUtils_1.retryHttpClientResponse)(`uploadChunk (start: ${start}, end: ${end})`, () => __awaiter(this, void 0, void 0, function* () {
440-
return httpClient.sendStream('PATCH', resourceUrl, openStream(), additionalHeaders);
445+
return s3HttpClient.sendStream('PUT', resourceUrl, openStream(), additionalHeaders);
441446
}));
442447
if (!(0, requestUtils_1.isSuccessStatusCode)(uploadChunkResponse.message.statusCode)) {
448+
core.debug(`Upload chunk failed with status message: ${JSON.stringify(uploadChunkResponse.message.statusMessage)}`);
449+
core.debug(`Upload chunk failed with headers: ${JSON.stringify(uploadChunkResponse.message.headers)}`);
450+
core.debug(`Upload chunk failed with response body: ${yield uploadChunkResponse.readBody()}`);
443451
throw new Error(`Cache service responded with ${uploadChunkResponse.message.statusCode} during upload chunk.`);
444452
}
453+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
454+
return uploadChunkResponse.message.headers.etag;
445455
});
446456
}
447-
function uploadFile(httpClient, cacheId, archivePath, options) {
457+
function uploadFile(archivePath, urls) {
448458
return __awaiter(this, void 0, void 0, function* () {
449459
// Upload Chunks
460+
core.debug(`archivePath: ${archivePath}`);
450461
const fileSize = utils.getArchiveFileSizeInBytes(archivePath);
451-
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
452462
const fd = fs.openSync(archivePath, 'r');
453-
const uploadOptions = (0, options_1.getUploadOptions)(options);
454-
const concurrency = utils.assertDefined('uploadConcurrency', uploadOptions.uploadConcurrency);
455-
const maxChunkSize = utils.assertDefined('uploadChunkSize', uploadOptions.uploadChunkSize);
456-
const parallelUploads = [...new Array(concurrency).keys()];
463+
const maxChunkSize = 25 * 1024 * 1024; // Matches the chunkSize in our cache service.
457464
core.debug('Awaiting all uploads');
458-
let offset = 0;
465+
let eTags = [];
459466
try {
460-
yield Promise.all(parallelUploads.map(() => __awaiter(this, void 0, void 0, function* () {
461-
while (offset < fileSize) {
462-
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
463-
const start = offset;
464-
const end = offset + chunkSize - 1;
465-
offset += maxChunkSize;
466-
yield uploadChunk(httpClient, resourceUrl, () => fs
467-
.createReadStream(archivePath, {
468-
fd,
469-
start,
470-
end,
471-
autoClose: false
472-
})
473-
.on('error', error => {
474-
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
475-
}), start, end);
476-
}
467+
eTags = yield Promise.all(urls.map((url, index) => __awaiter(this, void 0, void 0, function* () {
468+
const offset = index * maxChunkSize;
469+
const chunkSize = Math.min(fileSize - offset, maxChunkSize);
470+
const start = offset;
471+
let end = offset + chunkSize - 1;
472+
if (chunkSize !== maxChunkSize) {
473+
end = fileSize - 1;
474+
}
475+
core.debug(`Uploading chunk to ${url}: ${start}-${end}/${fileSize}`);
476+
const eTag = yield uploadChunk(url, () => fs
477+
.createReadStream(archivePath, {
478+
fd,
479+
start,
480+
end,
481+
autoClose: false
482+
})
483+
.on('error', error => {
484+
throw new Error(`Cache upload failed because file read failed with ${error.message}`);
485+
}), start, end);
486+
core.debug(`Upload to ${url} complete`);
487+
return eTag !== null && eTag !== void 0 ? eTag : '';
477488
})));
478489
}
490+
catch (error) {
491+
core.debug(`Cache upload failed: ${JSON.stringify(error)}`);
492+
throw error;
493+
}
479494
finally {
480495
fs.closeSync(fd);
481496
}
482-
return;
497+
return eTags;
483498
});
484499
}
485-
function commitCache(httpClient, cacheId, filesize) {
500+
function commitCache(httpClient, cacheId, filesize, eTags, uploadId) {
486501
return __awaiter(this, void 0, void 0, function* () {
487-
const commitCacheRequest = { size: filesize };
502+
const commitCacheRequest = {
503+
size: filesize,
504+
eTags,
505+
uploadId
506+
};
488507
return yield (0, requestUtils_1.retryTypedResponse)('commitCache', () => __awaiter(this, void 0, void 0, function* () {
489508
return httpClient.postJson(getCacheApiUrl(`caches/${cacheId.toString()}`), commitCacheRequest);
490509
}));
491510
});
492511
}
493-
function saveCache(cacheId, archivePath, options) {
512+
function saveCache(cacheId, archivePath, urls, uploadId) {
494513
return __awaiter(this, void 0, void 0, function* () {
495514
const httpClient = createHttpClient();
496515
core.debug('Upload cache');
497-
yield uploadFile(httpClient, cacheId, archivePath, options);
516+
const eTags = yield uploadFile(archivePath, urls);
498517
// Commit Cache
499518
core.debug('Commiting cache');
500519
const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
501520
core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
502-
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
521+
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize, eTags, uploadId);
503522
if (!(0, requestUtils_1.isSuccessStatusCode)(commitCacheResponse.statusCode)) {
504523
throw new Error(`Cache service responded with ${commitCacheResponse.statusCode} during commit cache.`);
505524
}
@@ -807,7 +826,6 @@ const buffer = __importStar(__nccwpck_require__(4300));
807826
const fs = __importStar(__nccwpck_require__(7147));
808827
const stream = __importStar(__nccwpck_require__(2781));
809828
const util = __importStar(__nccwpck_require__(3837));
810-
const utils = __importStar(__nccwpck_require__(1518));
811829
const constants_1 = __nccwpck_require__(8840);
812830
const requestUtils_1 = __nccwpck_require__(3981);
813831
const abort_controller_1 = __nccwpck_require__(2557);
@@ -817,10 +835,19 @@ const abort_controller_1 = __nccwpck_require__(2557);
817835
* @param response the HTTP response
818836
* @param output the writable stream
819837
*/
820-
function pipeResponseToStream(response, output) {
838+
function pipeResponseToStream(response, output, progress) {
821839
return __awaiter(this, void 0, void 0, function* () {
822840
const pipeline = util.promisify(stream.pipeline);
823-
yield pipeline(response.message, output);
841+
const reportProgress = new stream.Transform({
842+
transform(chunk, _encoding, callback) {
843+
if (progress) {
844+
progress.setReceivedBytes(progress.getTransferredBytes() + chunk.length);
845+
}
846+
this.push(chunk);
847+
callback();
848+
}
849+
});
850+
yield pipeline(response.message, reportProgress, output);
824851
});
825852
}
826853
/**
@@ -932,26 +959,67 @@ exports.DownloadProgress = DownloadProgress;
932959
*/
933960
function downloadCacheHttpClient(archiveLocation, archivePath) {
934961
return __awaiter(this, void 0, void 0, function* () {
935-
const writeStream = fs.createWriteStream(archivePath);
936-
const httpClient = new http_client_1.HttpClient('actions/cache');
937-
const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () => __awaiter(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); }));
938-
// Abort download if no traffic received over the socket.
939-
downloadResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
940-
downloadResponse.message.destroy();
941-
core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
942-
});
943-
yield pipeResponseToStream(downloadResponse, writeStream);
944-
// Validate download siz F438 e.
945-
const contentLengthHeader = downloadResponse.message.headers['content-length'];
946-
if (contentLengthHeader) {
947-
const expectedLength = parseInt(contentLengthHeader);
948-
const actualLength = utils.getArchiveFileSizeInBytes(archivePath);
949-
if (actualLength !== expectedLength) {
950-
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
951-
}
962+
const CONCURRENCY = 8;
963+
const fdesc = yield fs.promises.open(archivePath, 'w+');
964+
// Set file permissions so that other users can untar the cache
965+
yield fdesc.chmod(0o644);
966+
let progressLogger;
967+
try {
968+
core.debug(`Downloading from ${archiveLocation} to ${archivePath}`);
969+
const httpClient = new http_client_1.HttpClient('useblacksmith/cache');
970+
const metadataResponse = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () => __awaiter(this, void 0, void 0, function* () {
971+
return httpClient.get(archiveLocation, {
972+
Range: 'bytes=0-1'
973+
});
974+
}));
975+
// Abort download if no traffic received over the socket.
976+
metadataResponse.message.socket.setTimeout(constants_1.SocketTimeout, () => {
977+
metadataResponse.message.destroy();
978+
core.debug(`Aborting download, socket timed out after ${constants_1.SocketTimeout} ms`);
979+
});
980+
const contentRangeHeader = metadataResponse.message.headers['content-range'];
981+
if (!contentRangeHeader) {
982+
throw new Error('Content-Range is not defined; unable to determine file size');
983+
}
984+
// Parse the total file size from the Content-Range header
985+
const fileSize = parseInt(contentRangeHeader.split('/')[1]);
986+
if (isNaN(fileSize)) {
987+
throw new Error(`Content-Range is not a number; unable to determine file size: ${contentRangeHeader}`);
988+
}
989+
core.debug(`fileSize: ${fileSize}`);
990+
// Truncate the file to the correct size
991+
yield fdesc.truncate(fileSize);
992+
yield fdesc.sync();
993+
progressLogger = new DownloadProgress(fileSize);
994+
progressLogger.startDisplayTimer();
995+
// Divvy up the download into chunks based on CONCURRENCY
996+
const chunkSize = Math.ceil(fileSize / CONCURRENCY);
997+
const chunkRanges = [];
998+
for (let i = 0; i < CONCURRENCY; i++) {
999+
const start = i * chunkSize;
1000+
const end = i === CONCURRENCY - 1 ? fileSize - 1 : (i + 1) * chunkSize - 1;
1001+
chunkRanges.push(`bytes=${start}-${end}`);
1002+
}
1003+
const downloads = chunkRanges.map((range) => __awaiter(this, void 0, void 0, function* () {
1004+
core.debug(`Downloading range: ${range}`);
1005+
const response = yield (0, requestUtils_1.retryHttpClientResponse)('downloadCache', () => __awaiter(this, void 0, void 0, function* () {
1006+
return httpClient.get(archiveLocation, {
1007+
Range: range
1008+
});
1009+
}));
1010+
const writeStream = fs.createWriteStream(archivePath, {
1011+
fd: fdesc.fd,
1012+
start: parseInt(range.split('=')[1].split('-')[0]),
1013+
autoClose: false
1014+
});
1015+
yield pipeResponseToStream(response, writeStream, progressLogger);
1016+
core.debug(`Finished downloading range: ${range}`);
1017+
}));
1018+
yield Promise.all(downloads);
9521019
}
953-
else {
954-
core.debug('Unable to validate download, no Content-Length header');
1020+
finally {
1021+
yield fdesc.close();
1022+
progressLogger === null || progressLogger === void 0 ? void 0 : progressLogger.stopDisplayTimer();
9551023
}
9561024
});
9571025
}
@@ -966,6 +1034,7 @@ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options
9661034
var _a;
9671035
return __awaiter(this, void 0, void 0, function* () {
9681036
const archiveDescriptor = yield fs.promises.open(archivePath, 'w');
1037+
core.debug(`Downloading from ${archiveLocation} to ${archivePath}`);
9691038
const httpClient = new http_client_1.HttpClient('actions/cache', undefined, {
9701039
socketTimeout: options.timeoutInMs,
9711040
keepAlive: true
@@ -1265,6 +1334,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
12651334
// If the error object contains the statusCode property, extract it and return
12661335
// an TypedResponse<T> so it can be processed by the retry logic.
12671336
(error) => {
1337+
core.debug(`Error occurred during ${name}: ${JSON.stringify(error)}`);
12681338
if (error instanceof http_client_1.HttpClientError) {
12691339
return {
12701340
statusCode: error.statusCode,
@@ -1632,7 +1702,7 @@ function getDownloadOptions(copy) {
16321702
const result = {
16331703
useAzureSdk: false,
16341704
concurrentBlobDownloads: true,
1635-
downloadConcurrency: 8,
1705+
downloadConcurrency: 10,
16361706
timeoutInMs: 30000,
16371707
segmentTimeoutInMs: 600000,
16381708
lookupOnly: false

0 commit comments

Comments
 (0)
0