@@ -61338,7 +61338,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6133861338 return (mod && mod.__esModule) ? mod : { "default": mod };
6133961339};
6134061340Object.defineProperty(exports, "__esModule", ({ value: true }));
61341- exports.resolveStableVersionInput = exports.parseGoVersionFile = exports.makeSemver = exports.getVersionsDist = exports.findMatch = exports.getInfoFromManifest = exports.getManifest = exports.extractGoArchive = exports.addExecutablesToCache = exports. getGo = void 0;
61341+ exports.resolveStableVersionInput = exports.parseGoVersionFile = exports.makeSemver = exports.getVersionsDist = exports.findMatch = exports.getInfoFromManifest = exports.getManifest = exports.extractGoArchive = exports.getGo = void 0;
6134261342const tc = __importStar(__nccwpck_require__(7784));
6134361343const core = __importStar(__nccwpck_require__(2186));
6134461344const path = __importStar(__nccwpck_require__(1017));
@@ -61441,56 +61441,63 @@ function resolveVersionFromManifest(versionSpec, stable, auth, arch, manifest) {
6144161441 }
6144261442 });
6144361443}
61444- function addExecutablesToCache(extPath, info, arch) {
61445- return __awaiter(this, void 0, void 0, function* () {
61446- core.info('Adding to the cache ...');
61447- const cachedDir = yield tc.cacheDir(extPath, 'go', makeSemver(info.resolvedVersion), arch);
61448- core.info(`Successfully cached go to ${cachedDir}`);
61449- return cachedDir;
61450- });
61451- }
61452- exports.addExecutablesToCache = addExecutablesToCache;
61453- function installGoVersion(info, auth, arch) {
61444+ // for github hosted windows runner handle latency of OS drive
61445+ // by avoiding write operations to C:
61446+ function cacheWindowsToolkitDir(extPath, tool, version, arch) {
6145461447 return __awaiter(this, void 0, void 0, function* () {
61455- core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
61456- // Windows requires that we keep the extension (.zip) for extraction
61457- const isWindows = os_1.default.platform() === 'win32';
61458- const tempDir = process.env.RUNNER_TEMP || '.';
61459- const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined;
61460- const downloadPath = yield tc.downloadTool(info.downloadUrl, fileName, auth);
61461- core.info('Extracting Go...');
61462- let extPath = yield extractGoArchive(downloadPath);
61463- core.info(`Successfully extracted go to ${extPath}`);
61464- if (info.type === 'dist') {
61465- extPath = path.join(extPath, 'go');
61466- }
61467- // for github hosted windows runner handle latency of OS drive
61468- // by avoiding write operations to C:
61469- if (!isWindows)
61470- return addExecutablesToCache(extPath, info, arch);
61448+ if (os_1.default.platform() !== 'win32')
61449+ return false;
6147161450 const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted' ||
6147261451 process.env['AGENT_ISSELFHOSTED'] === '0';
6147361452 if (!isHosted)
61474- return addExecutablesToCache(extPath, info, arch) ;
61453+ return false ;
6147561454 const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'];
6147661455 if (!defaultToolCacheRoot)
61477- return addExecutablesToCache(extPath, info, arch) ;
61456+ return false ;
6147861457 if (!fs_1.default.existsSync('d:\\') || !fs_1.default.existsSync('c:\\'))
61479- return addExecutablesToCache(extPath, info, arch) ;
61458+ return false ;
6148061459 const substitutedToolCacheRoot = defaultToolCacheRoot
6148161460 .replace('C:', 'D:')
6148261461 .replace('c:', 'd:');
6148361462 // make toolcache root to be on drive d:
6148461463 process.env['RUNNER_TOOL_CACHE'] = substitutedToolCacheRoot;
61485- const actualToolCacheDir = yield addExecutablesToCache (extPath, info , arch);
61464+ const actualToolCacheDir = yield tc.cacheDir (extPath, tool, version , arch);
6148661465 // create a link from c: to d:
6148761466 const defaultToolCacheDir = actualToolCacheDir.replace(substitutedToolCacheRoot, defaultToolCacheRoot);
6148861467 fs_1.default.mkdirSync(path.dirname(defaultToolCacheDir), { recursive: true });
6148961468 fs_1.default.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction');
6149061469 core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`);
61470+ // make outer code to continue using toolcache as if it were installed on c:
6149161471 // restore toolcache root to default drive c:
6149261472 process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot;
61493- // make outer code to continue using toolcache as if it were installed on c:
61473+ return defaultToolCacheDir;
61474+ });
61475+ }
61476+ function addExecutablesToCache(extPath, info, arch) {
61477+ return __awaiter(this, void 0, void 0, function* () {
61478+ const tool = 'go';
61479+ const version = makeSemver(info.resolvedVersion);
61480+ return ((yield cacheWindowsToolkitDir(extPath, tool, version, arch)) ||
61481+ (yield tc.cacheDir(extPath, tool, version, arch)));
61482+ });
61483+ }
61484+ function installGoVersion(info, auth, arch) {
61485+ return __awaiter(this, void 0, void 0, function* () {
61486+ core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
61487+ // Windows requires that we keep the extension (.zip) for extraction
61488+ const isWindows = os_1.default.platform() === 'win32';
61489+ const tempDir = process.env.RUNNER_TEMP || '.';
61490+ const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined;
61491+ const downloadPath = yield tc.downloadTool(info.downloadUrl, fileName, auth);
61492+ core.info('Extracting Go...');
61493+ let extPath = yield extractGoArchive(downloadPath);
61494+ core.info(`Successfully extracted go to ${extPath}`);
61495+ if (info.type === 'dist') {
61496+ extPath = path.join(extPath, 'go');
61497+ }
61498+ core.info('Adding to the cache ...');
61499+ const defaultToolCacheDir = yield addExecutablesToCache(extPath, info, arch);
61500+ core.info(`Successfully cached go to ${defaultToolCacheDir}`);
6149461501 return defaultToolCacheDir;
6149561502 });
6149661503}
0 commit comments