|
|
|
@ -43295,7 +43295,7 @@ class CacheService {
|
|
|
|
|
restoreCache(paths, primaryKey, restoreKeys) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
restoreKeys = restoreKeys || [];
|
|
|
|
|
const keys = [primaryKey, ...restoreKeys];
|
|
|
|
|
const keys = [primaryKey, ...restoreKeys].map(x => this.formatKey(x));
|
|
|
|
|
core.debug("Resolved Keys:");
|
|
|
|
|
core.debug(JSON.stringify(keys));
|
|
|
|
|
const compressionMethod = yield utils.getCompressionMethod();
|
|
|
|
@ -43331,6 +43331,7 @@ class CacheService {
|
|
|
|
|
}
|
|
|
|
|
saveCache(paths, key) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const formattedKey = this.formatKey(key);
|
|
|
|
|
const compressionMethod = yield utils.getCompressionMethod();
|
|
|
|
|
const cachePaths = yield utils.resolvePaths(paths);
|
|
|
|
|
core.debug("Cache Paths:");
|
|
|
|
@ -43344,8 +43345,8 @@ class CacheService {
|
|
|
|
|
yield tar_1.listTar(archivePath, compressionMethod);
|
|
|
|
|
}
|
|
|
|
|
core.info(`Archive Size: ${filesize_1.default(fs_1.default.statSync(archivePath).size)}`);
|
|
|
|
|
core.debug(`Saving Cache (ID: ${key})`);
|
|
|
|
|
yield this.uploadToS3(key, archivePath);
|
|
|
|
|
core.debug(`Saving Cache (ID: ${formattedKey})`);
|
|
|
|
|
yield this.uploadToS3(formattedKey, archivePath);
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
// Try to delete the archive to save space
|
|
|
|
@ -43356,7 +43357,7 @@ class CacheService {
|
|
|
|
|
core.debug(`Failed to delete archive: ${error}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return key;
|
|
|
|
|
return formattedKey;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
uploadToS3(key, archivePath) {
|
|
|
|
@ -43451,6 +43452,9 @@ class CacheService {
|
|
|
|
|
.replace("/", "-")
|
|
|
|
|
.toLowerCase();
|
|
|
|
|
}
|
|
|
|
|
formatKey(key) {
|
|
|
|
|
return key.replace(/[^\w\s]/gi, "-");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exports.CacheService = CacheService;
|
|
|
|
|
|
|
|
|
|