|
|
@ -3342,10 +3342,7 @@ const options_1 = __webpack_require__(538);
|
|
|
|
const requestUtils_1 = __webpack_require__(899);
|
|
|
|
const requestUtils_1 = __webpack_require__(899);
|
|
|
|
const versionSalt = '1.0';
|
|
|
|
const versionSalt = '1.0';
|
|
|
|
function getCacheApiUrl(resource) {
|
|
|
|
function getCacheApiUrl(resource) {
|
|
|
|
// Ideally we just use ACTIONS_CACHE_URL
|
|
|
|
const baseUrl = process.env['ACTIONS_CACHE_URL'] || '';
|
|
|
|
const baseUrl = (process.env['ACTIONS_CACHE_URL'] ||
|
|
|
|
|
|
|
|
process.env['ACTIONS_RUNTIME_URL'] ||
|
|
|
|
|
|
|
|
'').replace('pipelines', 'artifactcache');
|
|
|
|
|
|
|
|
if (!baseUrl) {
|
|
|
|
if (!baseUrl) {
|
|
|
|
throw new Error('Cache Service Url not found, unable to restore cache.');
|
|
|
|
throw new Error('Cache Service Url not found, unable to restore cache.');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -3689,6 +3686,7 @@ exports.addBinToPath = exports.run = void 0;
|
|
|
|
const core = __importStar(__webpack_require__(470));
|
|
|
|
const core = __importStar(__webpack_require__(470));
|
|
|
|
const io = __importStar(__webpack_require__(1));
|
|
|
|
const io = __importStar(__webpack_require__(1));
|
|
|
|
const installer = __importStar(__webpack_require__(923));
|
|
|
|
const installer = __importStar(__webpack_require__(923));
|
|
|
|
|
|
|
|
const semver = __importStar(__webpack_require__(280));
|
|
|
|
const path_1 = __importDefault(__webpack_require__(622));
|
|
|
|
const path_1 = __importDefault(__webpack_require__(622));
|
|
|
|
const cache_restore_1 = __webpack_require__(409);
|
|
|
|
const cache_restore_1 = __webpack_require__(409);
|
|
|
|
const child_process_1 = __importDefault(__webpack_require__(129));
|
|
|
|
const child_process_1 = __importDefault(__webpack_require__(129));
|
|
|
@ -3709,9 +3707,14 @@ function run() {
|
|
|
|
let auth = !token || isGhes() ? undefined : `token ${token}`;
|
|
|
|
let auth = !token || isGhes() ? undefined : `token ${token}`;
|
|
|
|
const checkLatest = core.getBooleanInput('check-latest');
|
|
|
|
const checkLatest = core.getBooleanInput('check-latest');
|
|
|
|
const installDir = yield installer.getGo(versionSpec, checkLatest, auth);
|
|
|
|
const installDir = yield installer.getGo(versionSpec, checkLatest, auth);
|
|
|
|
core.exportVariable('GOROOT', installDir);
|
|
|
|
|
|
|
|
core.addPath(path_1.default.join(installDir, 'bin'));
|
|
|
|
core.addPath(path_1.default.join(installDir, 'bin'));
|
|
|
|
core.info('Added go to the path');
|
|
|
|
core.info('Added go to the path');
|
|
|
|
|
|
|
|
const version = installer.makeSemver(versionSpec);
|
|
|
|
|
|
|
|
// Go versions less than 1.9 require GOROOT to be set
|
|
|
|
|
|
|
|
if (semver.lt(version, '1.9.0')) {
|
|
|
|
|
|
|
|
core.info('Setting GOROOT for Go version < 1.9');
|
|
|
|
|
|
|
|
core.exportVariable('GOROOT', installDir);
|
|
|
|
|
|
|
|
}
|
|
|
|
let added = yield addBinToPath();
|
|
|
|
let added = yield addBinToPath();
|
|
|
|
core.debug(`add bin ${added}`);
|
|
|
|
core.debug(`add bin ${added}`);
|
|
|
|
core.info(`Successfully setup go version ${versionSpec}`);
|
|
|
|
core.info(`Successfully setup go version ${versionSpec}`);
|
|
|
@ -3758,12 +3761,12 @@ function addBinToPath() {
|
|
|
|
if (!fs_1.default.existsSync(gp)) {
|
|
|
|
if (!fs_1.default.existsSync(gp)) {
|
|
|
|
// some of the hosted images have go install but not profile dir
|
|
|
|
// some of the hosted images have go install but not profile dir
|
|
|
|
core.debug(`creating ${gp}`);
|
|
|
|
core.debug(`creating ${gp}`);
|
|
|
|
io.mkdirP(gp);
|
|
|
|
yield io.mkdirP(gp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let bp = path_1.default.join(gp, 'bin');
|
|
|
|
let bp = path_1.default.join(gp, 'bin');
|
|
|
|
if (!fs_1.default.existsSync(bp)) {
|
|
|
|
if (!fs_1.default.existsSync(bp)) {
|
|
|
|
core.debug(`creating ${bp}`);
|
|
|
|
core.debug(`creating ${bp}`);
|
|
|
|
io.mkdirP(bp);
|
|
|
|
yield io.mkdirP(bp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
core.addPath(bp);
|
|
|
|
core.addPath(bp);
|
|
|
|
added = true;
|
|
|
|
added = true;
|
|
|
@ -6079,7 +6082,8 @@ function downloadCacheStorageSDK(archiveLocation, archivePath, options) {
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
|
|
|
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
|
|
|
|
// on 64-bit systems), split the download into multiple segments
|
|
|
|
// on 64-bit systems), split the download into multiple segments
|
|
|
|
const maxSegmentSize = buffer.constants.MAX_LENGTH;
|
|
|
|
// ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
|
|
|
|
|
|
|
|
const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH);
|
|
|
|
const downloadProgress = new DownloadProgress(contentLength);
|
|
|
|
const downloadProgress = new DownloadProgress(contentLength);
|
|
|
|
const fd = fs.openSync(archivePath, 'w');
|
|
|
|
const fd = fs.openSync(archivePath, 'w');
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -45171,6 +45175,15 @@ function checkKey(key) {
|
|
|
|
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
|
|
|
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* isFeatureAvailable to check the presence of Actions cache service
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @returns boolean return true if Actions cache service feature is available, otherwise false
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function isFeatureAvailable() {
|
|
|
|
|
|
|
|
return !!process.env['ACTIONS_CACHE_URL'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.isFeatureAvailable = isFeatureAvailable;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Restores cache from keys
|
|
|
|
* Restores cache from keys
|
|
|
|
*
|
|
|
|
*
|
|
|
|