mirror of
https://github.com/actions/cache.git
synced 2024-11-30 15:29:03 +00:00
Use latest toolkit changes
This commit is contained in:
parent
57eada13e4
commit
ae0428be59
85
dist/restore-only/index.js
vendored
85
dist/restore-only/index.js
vendored
@ -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);
|
||||
@ -6007,8 +6007,11 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
}
|
||||
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
// Download the cache archive from from blob storage
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options ||
|
||||
{
|
||||
timeoutInMs: 30000
|
||||
});
|
||||
if (core.isDebug()) {
|
||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||
}
|
||||
@ -6084,8 +6087,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 +6134,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 +6270,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 +8055,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 +8096,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 +8108,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;
|
||||
|
85
dist/restore/index.js
vendored
85
dist/restore/index.js
vendored
@ -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);
|
||||
@ -6007,8 +6007,11 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
}
|
||||
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
// Download the cache archive from from blob storage
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options ||
|
||||
{
|
||||
timeoutInMs: 30000
|
||||
});
|
||||
if (core.isDebug()) {
|
||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||
}
|
||||
@ -6084,8 +6087,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 +6134,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 +6270,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 +8055,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 +8096,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 +8108,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;
|
||||
|
85
dist/save-only/index.js
vendored
85
dist/save-only/index.js
vendored
@ -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);
|
||||
@ -6007,8 +6007,11 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
}
|
||||
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
// Download the cache archive from from blob storage
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options ||
|
||||
{
|
||||
timeoutInMs: 30000
|
||||
});
|
||||
if (core.isDebug()) {
|
||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||
}
|
||||
@ -6084,8 +6087,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 +6134,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 +6270,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 +8055,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 +8096,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 +8108,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;
|
||||
|
85
dist/save/index.js
vendored
85
dist/save/index.js
vendored
@ -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);
|
||||
@ -6007,8 +6007,11 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
}
|
||||
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
|
||||
core.debug(`Archive Path: ${archivePath}`);
|
||||
// Download the cache from the cache entry
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
|
||||
// Download the cache archive from from blob storage
|
||||
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options ||
|
||||
{
|
||||
timeoutInMs: 30000
|
||||
});
|
||||
if (core.isDebug()) {
|
||||
yield (0, tar_1.listTar)(archivePath, compressionMethod);
|
||||
}
|
||||
@ -6084,8 +6087,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 +6134,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 +6270,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 +8055,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 +8096,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 +8108,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;
|
||||
|
Loading…
Reference in New Issue
Block a user