Compare commits

..

2 Commits

Author SHA1 Message Date
Bassem Dghaidi
2893d426fc Refactor 2024-11-27 05:58:56 -08:00
Bassem Dghaidi
ae0428be59 Use latest toolkit changes 2024-11-27 04:53:56 -08:00
4 changed files with 68 additions and 256 deletions

View File

@@ -5898,11 +5898,11 @@ const path = __importStar(__nccwpck_require__(1017));
const utils = __importStar(__nccwpck_require__(3310));
const cacheHttpClient = __importStar(__nccwpck_require__(2370));
const cacheTwirpClient = __importStar(__nccwpck_require__(5726));
const downloadUtils_1 = __nccwpck_require__(318);
const config_1 = __nccwpck_require__(6490);
const tar_1 = __nccwpck_require__(9099);
const constants_1 = __nccwpck_require__(4010);
const upload_cache_1 = __nccwpck_require__(302);
const download_cache_1 = __nccwpck_require__(4076);
class ValidationError extends Error {
constructor(message) {
super(message);
@@ -6084,8 +6084,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive path: ${archivePath}`);
core.debug(`Starting download of archive to: ${archivePath}`);
const downloadResponse = yield (0, download_cache_1.downloadCacheFile)(response.signedDownloadUrl, archivePath);
core.debug(`Download response status: ${downloadResponse._response.status}`);
yield (0, downloadUtils_1.downloadCacheStorageSDK)(response.signedDownloadUrl, archivePath, options ||
{
timeoutInMs: 30000
});
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
if (core.isDebug()) {
@@ -6129,9 +6131,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
*/
function saveCache(paths, key, options, enableCrossOsArchive = false) {
return __awaiter(this, void 0, void 0, function* () {
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
core.debug(`Cache service version: ${cacheServiceVersion}`);
checkPaths(paths);
checkKey(key);
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
switch (cacheServiceVersion) {
case 'v2':
return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
@@ -6264,7 +6267,8 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core.debug(`Attempting to upload cache located at: ${archivePath}`);
yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
const uploadResponse = yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
core.debug(`Download response status: ${uploadResponse._response.status}`);
const finalizeRequest = {
key,
version,
@@ -8048,63 +8052,6 @@ exports.CacheScope = new CacheScope$Type();
/***/ }),
/***/ 4076:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.downloadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
function downloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = {
maxRetryRequests: 5
};
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.downloadToFile(archivePath, 0, undefined, downloadOptions);
});
}
exports.downloadCacheFile = downloadCacheFile;
//# sourceMappingURL=download-cache.js.map
/***/ }),
/***/ 302:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
@@ -8146,6 +8093,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.uploadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
const errors_1 = __nccwpck_require__(6333);
function uploadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
// Specify data transfer options
@@ -8157,7 +8105,11 @@ function uploadCacheFile(signedUploadURL, archivePath) {
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.uploadFile(archivePath, uploadOptions);
const resp = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
if (resp._response.status >= 400) {
throw new errors_1.InvalidResponseError(`Upload failed with status code ${resp._response.status}`);
}
return resp;
});
}
exports.uploadCacheFile = uploadCacheFile;
@@ -8214,6 +8166,7 @@ const downloadUtils_1 = __nccwpck_require__(318);
const options_1 = __nccwpck_require__(7190);
const requestUtils_1 = __nccwpck_require__(7865);
const config_1 = __nccwpck_require__(6490);
const user_agent_1 = __nccwpck_require__(5736);
function getCacheApiUrl(resource) {
const baseUrl = (0, config_1.getCacheServiceURL)();
if (!baseUrl) {
@@ -8237,7 +8190,7 @@ function getRequestOptions() {
function createHttpClient() {
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
return new http_client_1.HttpClient((0, user_agent_1.getUserAgentString)(), [bearerCredentialHandler], getRequestOptions());
}
function getCacheEntry(keys, paths, options) {
return __awaiter(this, void 0, void 0, function* () {

81
dist/restore/index.js vendored
View File

@@ -5898,11 +5898,11 @@ const path = __importStar(__nccwpck_require__(1017));
const utils = __importStar(__nccwpck_require__(3310));
const cacheHttpClient = __importStar(__nccwpck_require__(2370));
const cacheTwirpClient = __importStar(__nccwpck_require__(5726));
const downloadUtils_1 = __nccwpck_require__(318);
const config_1 = __nccwpck_require__(6490);
const tar_1 = __nccwpck_require__(9099);
const constants_1 = __nccwpck_require__(4010);
const upload_cache_1 = __nccwpck_require__(302);
const download_cache_1 = __nccwpck_require__(4076);
class ValidationError extends Error {
constructor(message) {
super(message);
@@ -6084,8 +6084,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive path: ${archivePath}`);
core.debug(`Starting download of archive to: ${archivePath}`);
const downloadResponse = yield (0, download_cache_1.downloadCacheFile)(response.signedDownloadUrl, archivePath);
core.debug(`Download response status: ${downloadResponse._response.status}`);
yield (0, downloadUtils_1.downloadCacheStorageSDK)(response.signedDownloadUrl, archivePath, options ||
{
timeoutInMs: 30000
});
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
if (core.isDebug()) {
@@ -6129,9 +6131,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
*/
function saveCache(paths, key, options, enableCrossOsArchive = false) {
return __awaiter(this, void 0, void 0, function* () {
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
core.debug(`Cache service version: ${cacheServiceVersion}`);
checkPaths(paths);
checkKey(key);
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
switch (cacheServiceVersion) {
case 'v2':
return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
@@ -6264,7 +6267,8 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core.debug(`Attempting to upload cache located at: ${archivePath}`);
yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
const uploadResponse = yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
core.debug(`Download response status: ${uploadResponse._response.status}`);
const finalizeRequest = {
key,
version,
@@ -8048,63 +8052,6 @@ exports.CacheScope = new CacheScope$Type();
/***/ }),
/***/ 4076:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.downloadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
function downloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = {
maxRetryRequests: 5
};
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.downloadToFile(archivePath, 0, undefined, downloadOptions);
});
}
exports.downloadCacheFile = downloadCacheFile;
//# sourceMappingURL=download-cache.js.map
/***/ }),
/***/ 302:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
@@ -8146,6 +8093,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.uploadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
const errors_1 = __nccwpck_require__(6333);
function uploadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
// Specify data transfer options
@@ -8157,7 +8105,11 @@ function uploadCacheFile(signedUploadURL, archivePath) {
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.uploadFile(archivePath, uploadOptions);
const resp = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
if (resp._response.status >= 400) {
throw new errors_1.InvalidResponseError(`Upload failed with status code ${resp._response.status}`);
}
return resp;
});
}
exports.uploadCacheFile = uploadCacheFile;
@@ -8214,6 +8166,7 @@ const downloadUtils_1 = __nccwpck_require__(318);
const options_1 = __nccwpck_require__(7190);
const requestUtils_1 = __nccwpck_require__(7865);
const config_1 = __nccwpck_require__(6490);
const user_agent_1 = __nccwpck_require__(5736);
function getCacheApiUrl(resource) {
const baseUrl = (0, config_1.getCacheServiceURL)();
if (!baseUrl) {
@@ -8237,7 +8190,7 @@ function getRequestOptions() {
function createHttpClient() {
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
return new http_client_1.HttpClient((0, user_agent_1.getUserAgentString)(), [bearerCredentialHandler], getRequestOptions());
}
function getCacheEntry(keys, paths, options) {
return __awaiter(this, void 0, void 0, function* () {

View File

@@ -5898,11 +5898,11 @@ const path = __importStar(__nccwpck_require__(1017));
const utils = __importStar(__nccwpck_require__(3310));
const cacheHttpClient = __importStar(__nccwpck_require__(2370));
const cacheTwirpClient = __importStar(__nccwpck_require__(5726));
const downloadUtils_1 = __nccwpck_require__(318);
const config_1 = __nccwpck_require__(6490);
const tar_1 = __nccwpck_require__(9099);
const constants_1 = __nccwpck_require__(4010);
const upload_cache_1 = __nccwpck_require__(302);
const download_cache_1 = __nccwpck_require__(4076);
class ValidationError extends Error {
constructor(message) {
super(message);
@@ -6084,8 +6084,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive path: ${archivePath}`);
core.debug(`Starting download of archive to: ${archivePath}`);
const downloadResponse = yield (0, download_cache_1.downloadCacheFile)(response.signedDownloadUrl, archivePath);
core.debug(`Download response status: ${downloadResponse._response.status}`);
yield (0, downloadUtils_1.downloadCacheStorageSDK)(response.signedDownloadUrl, archivePath, options ||
{
timeoutInMs: 30000
});
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
if (core.isDebug()) {
@@ -6129,9 +6131,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
*/
function saveCache(paths, key, options, enableCrossOsArchive = false) {
return __awaiter(this, void 0, void 0, function* () {
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
core.debug(`Cache service version: ${cacheServiceVersion}`);
checkPaths(paths);
checkKey(key);
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
switch (cacheServiceVersion) {
case 'v2':
return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
@@ -6264,7 +6267,8 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core.debug(`Attempting to upload cache located at: ${archivePath}`);
yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
const uploadResponse = yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
core.debug(`Download response status: ${uploadResponse._response.status}`);
const finalizeRequest = {
key,
version,
@@ -8048,63 +8052,6 @@ exports.CacheScope = new CacheScope$Type();
/***/ }),
/***/ 4076:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.downloadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
function downloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = {
maxRetryRequests: 5
};
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.downloadToFile(archivePath, 0, undefined, downloadOptions);
});
}
exports.downloadCacheFile = downloadCacheFile;
//# sourceMappingURL=download-cache.js.map
/***/ }),
/***/ 302:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
@@ -8146,6 +8093,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.uploadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
const errors_1 = __nccwpck_require__(6333);
function uploadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
// Specify data transfer options
@@ -8157,7 +8105,11 @@ function uploadCacheFile(signedUploadURL, archivePath) {
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.uploadFile(archivePath, uploadOptions);
const resp = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
if (resp._response.status >= 400) {
throw new errors_1.InvalidResponseError(`Upload failed with status code ${resp._response.status}`);
}
return resp;
});
}
exports.uploadCacheFile = uploadCacheFile;
@@ -8214,6 +8166,7 @@ const downloadUtils_1 = __nccwpck_require__(318);
const options_1 = __nccwpck_require__(7190);
const requestUtils_1 = __nccwpck_require__(7865);
const config_1 = __nccwpck_require__(6490);
const user_agent_1 = __nccwpck_require__(5736);
function getCacheApiUrl(resource) {
const baseUrl = (0, config_1.getCacheServiceURL)();
if (!baseUrl) {
@@ -8237,7 +8190,7 @@ function getRequestOptions() {
function createHttpClient() {
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
return new http_client_1.HttpClient((0, user_agent_1.getUserAgentString)(), [bearerCredentialHandler], getRequestOptions());
}
function getCacheEntry(keys, paths, options) {
return __awaiter(this, void 0, void 0, function* () {

81
dist/save/index.js vendored
View File

@@ -5898,11 +5898,11 @@ const path = __importStar(__nccwpck_require__(1017));
const utils = __importStar(__nccwpck_require__(3310));
const cacheHttpClient = __importStar(__nccwpck_require__(2370));
const cacheTwirpClient = __importStar(__nccwpck_require__(5726));
const downloadUtils_1 = __nccwpck_require__(318);
const config_1 = __nccwpck_require__(6490);
const tar_1 = __nccwpck_require__(9099);
const constants_1 = __nccwpck_require__(4010);
const upload_cache_1 = __nccwpck_require__(302);
const download_cache_1 = __nccwpck_require__(4076);
class ValidationError extends Error {
constructor(message) {
super(message);
@@ -6084,8 +6084,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive path: ${archivePath}`);
core.debug(`Starting download of archive to: ${archivePath}`);
const downloadResponse = yield (0, download_cache_1.downloadCacheFile)(response.signedDownloadUrl, archivePath);
core.debug(`Download response status: ${downloadResponse._response.status}`);
yield (0, downloadUtils_1.downloadCacheStorageSDK)(response.signedDownloadUrl, archivePath, options ||
{
timeoutInMs: 30000
});
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
if (core.isDebug()) {
@@ -6129,9 +6131,10 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
*/
function saveCache(paths, key, options, enableCrossOsArchive = false) {
return __awaiter(this, void 0, void 0, function* () {
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
core.debug(`Cache service version: ${cacheServiceVersion}`);
checkPaths(paths);
checkKey(key);
const cacheServiceVersion = (0, config_1.getCacheServiceVersion)();
switch (cacheServiceVersion) {
case 'v2':
return yield saveCacheV2(paths, key, options, enableCrossOsArchive);
@@ -6264,7 +6267,8 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
}
core.debug(`Attempting to upload cache located at: ${archivePath}`);
yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
const uploadResponse = yield (0, upload_cache_1.uploadCacheFile)(response.signedUploadUrl, archivePath);
core.debug(`Download response status: ${uploadResponse._response.status}`);
const finalizeRequest = {
key,
version,
@@ -8048,63 +8052,6 @@ exports.CacheScope = new CacheScope$Type();
/***/ }),
/***/ 4076:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.downloadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
function downloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = {
maxRetryRequests: 5
};
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.downloadToFile(archivePath, 0, undefined, downloadOptions);
});
}
exports.downloadCacheFile = downloadCacheFile;
//# sourceMappingURL=download-cache.js.map
/***/ }),
/***/ 302:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
@@ -8146,6 +8093,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.uploadCacheFile = void 0;
const core = __importStar(__nccwpck_require__(4850));
const storage_blob_1 = __nccwpck_require__(3864);
const errors_1 = __nccwpck_require__(6333);
function uploadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () {
// Specify data transfer options
@@ -8157,7 +8105,11 @@ function uploadCacheFile(signedUploadURL, archivePath) {
const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient();
core.debug(`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`);
return blockBlobClient.uploadFile(archivePath, uploadOptions);
const resp = yield blockBlobClient.uploadFile(archivePath, uploadOptions);
if (resp._response.status >= 400) {
throw new errors_1.InvalidResponseError(`Upload failed with status code ${resp._response.status}`);
}
return resp;
});
}
exports.uploadCacheFile = uploadCacheFile;
@@ -8214,6 +8166,7 @@ const downloadUtils_1 = __nccwpck_require__(318);
const options_1 = __nccwpck_require__(7190);
const requestUtils_1 = __nccwpck_require__(7865);
const config_1 = __nccwpck_require__(6490);
const user_agent_1 = __nccwpck_require__(5736);
function getCacheApiUrl(resource) {
const baseUrl = (0, config_1.getCacheServiceURL)();
if (!baseUrl) {
@@ -8237,7 +8190,7 @@ function getRequestOptions() {
function createHttpClient() {
const token = process.env['ACTIONS_RUNTIME_TOKEN'] || '';
const bearerCredentialHandler = new auth_1.BearerCredentialHandler(token);
return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions());
return new http_client_1.HttpClient((0, user_agent_1.getUserAgentString)(), [bearerCredentialHandler], getRequestOptions());
}
function getCacheEntry(keys, paths, options) {
return __awaiter(this, void 0, void 0, function* () {