fix: sync .complete marker when caching tools on windows

This commit is contained in:
Piotr Galar 2023-08-12 23:31:51 +02:00 committed by galargh
parent aabcd82874
commit 89a192af9d
2 changed files with 9 additions and 0 deletions

4
dist/setup/index.js vendored
View File

@ -61514,6 +61514,10 @@ function cacheWindowsDir(extPath, tool, version, arch) {
fs_1.default.mkdirSync(path.dirname(defaultToolCacheDir), { recursive: true }); fs_1.default.mkdirSync(path.dirname(defaultToolCacheDir), { recursive: true });
fs_1.default.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); fs_1.default.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction');
core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`); core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`);
const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`;
const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`;
fs_1.default.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file');
core.info(`Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}`);
// make outer code to continue using toolcache as if it were installed on c: // make outer code to continue using toolcache as if it were installed on c:
// restore toolcache root to default drive c: // restore toolcache root to default drive c:
process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot;

View File

@ -203,6 +203,11 @@ async function cacheWindowsDir(
fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction'); fs.symlinkSync(actualToolCacheDir, defaultToolCacheDir, 'junction');
core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`); core.info(`Created link ${defaultToolCacheDir} => ${actualToolCacheDir}`);
const actualToolCacheCompleteFile = `${actualToolCacheDir}.complete`;
const defaultToolCacheCompleteFile = `${defaultToolCacheDir}.complete`;
fs.symlinkSync(actualToolCacheCompleteFile, defaultToolCacheCompleteFile, 'file');
core.info(`Created link ${defaultToolCacheCompleteFile} => ${actualToolCacheCompleteFile}`);
// make outer code to continue using toolcache as if it were installed on c: // make outer code to continue using toolcache as if it were installed on c:
// restore toolcache root to default drive c: // restore toolcache root to default drive c:
process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot; process.env['RUNNER_TOOL_CACHE'] = defaultToolCacheRoot;