@@ -1148,11 +1148,6 @@ function assertDefined(name, value) {
1148
1148
return value;
1149
1149
}
1150
1150
exports.assertDefined = assertDefined;
1151
- function isGhes() {
1152
- const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
1153
- return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
1154
- }
1155
- exports.isGhes = isGhes;
1156
1151
//# sourceMappingURL=cacheUtils.js.map
1157
1152
1158
1153
/***/ }),
@@ -3964,18 +3959,18 @@ function downloadCache(archiveLocation, archivePath, options) {
3964
3959
exports.downloadCache = downloadCache;
3965
3960
// Reserve Cache
3966
3961
function reserveCache(key, paths, options) {
3962
+ var _a, _b;
3967
3963
return __awaiter(this, void 0, void 0, function* () {
3968
3964
const httpClient = createHttpClient();
3969
3965
const version = getCacheVersion(paths, options === null || options === void 0 ? void 0 : options.compressionMethod);
3970
3966
const reserveCacheRequest = {
3971
3967
key,
3972
- version,
3973
- cacheSize: options === null || options === void 0 ? void 0 : options.cacheSize
3968
+ version
3974
3969 };
3975
3970
const response = yield requestUtils_1.retryTypedResponse('reserveCache', () => __awaiter(this, void 0, void 0, function* () {
3976
3971
return httpClient.postJson(getCacheApiUrl('caches'), reserveCacheRequest);
3977
3972
}));
3978
- return response;
3973
+ return (_b = (_a = response === null || response === void 0 ? void 0 : response.result) === null || _a === void 0 ? void 0 : _a.cacheId) !== null && _b !== void 0 ? _b : -1 ;
3979
3974
});
3980
3975
}
3981
3976
exports.reserveCache = reserveCache;
@@ -6112,6 +6107,9 @@ function run() {
6112
6107
yield cacheDependencies(cache, pythonVersion);
6113
6108
}
6114
6109
}
6110
+ else {
6111
+ throw new Error('there\'s empty python-version input');
6112
+ }
6115
6113
const matchersPath = path.join(__dirname, '../..', '.github');
6116
6114
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
6117
6115
}
@@ -47087,12 +47085,18 @@ exports.restoreCache = restoreCache;
47087
47085
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
47088
47086
*/
47089
47087
function saveCache(paths, key, options) {
47090
- var _a, _b, _c, _d, _e;
47091
47088
return __awaiter(this, void 0, void 0, function* () {
47092
47089
checkPaths(paths);
47093
47090
checkKey(key);
47094
47091
const compressionMethod = yield utils.getCompressionMethod();
47095
- let cacheId = null;
47092
+ core.debug('Reserving Cache');
47093
+ const cacheId = yield cacheHttpClient.reserveCache(key, paths, {
47094
+ compressionMethod
47095
+ });
47096
+ if (cacheId === -1) {
47097
+ throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
47098
+ }
47099
+ core.debug(`Cache ID: ${cacheId}`);
47096
47100
const cachePaths = yield utils.resolvePaths(paths);
47097
47101
core.debug('Cache Paths:');
47098
47102
core.debug(`${JSON.stringify(cachePaths)}`);
@@ -47107,24 +47111,9 @@ function saveCache(paths, key, options) {
47107
47111
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
47108
47112
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
47109
47113
core.debug(`File Size: ${archiveFileSize}`);
47110
- // For GHES, this check will take place in ReserveCache API with enterprise file size limit
47111
- if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
47114
+ if (archiveFileSize > fileSizeLimit) {
47112
47115
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
47113
47116
}
47114
- core.debug('Reserving Cache');
47115
- const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
47116
- compressionMethod,
47117
- cacheSize: archiveFileSize
47118
- });
47119
- if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
47120
- cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
47121
- }
47122
- else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
47123
- throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
47124
- }
47125
- else {
47126
- 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}`);
47127
- }
47128
47117
core.debug(`Saving Cache (ID: ${cacheId})`);
47129
47118
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
47130
47119
}
@@ -56433,8 +56422,7 @@ function retryTypedResponse(name, method, maxAttempts = constants_1.DefaultRetry
56433
56422
return {
56434
56423
statusCode: error.statusCode,
56435
56424
result: null,
56436
- headers: {},
56437
- error
56425
+ headers: {}
56438
56426
};
56439
56427
}
56440
56428
else {
0 commit comments