This commit is contained in:
Caleb Gosiak 2021-09-30 18:56:21 -05:00
parent 9d956bc62d
commit 0b4a0a4930
4 changed files with 26 additions and 13 deletions

12
dist/restore/index.js vendored
View file

@ -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;

12
dist/save/index.js vendored
View file

@ -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;