Create the .complete file so tc.find() can find it for future runs for self-hosted runners

This commit is contained in:
Benoit Daloze
2020-12-05 16:36:46 +01:00
parent 42fc2d3bce
commit 23b2b5e5f1
4 changed files with 31 additions and 4 deletions
+5
View File
@@ -99,6 +99,11 @@ export function getToolCacheRubyPrefix(platform, version) {
return path.join(toolCache, 'Ruby', version, 'x64')
}
export function createToolCacheCompleteFile(toolCacheRubyPrefix) {
const completeFile = `${toolCacheRubyPrefix}.complete`
fs.writeFileSync(completeFile, '')
}
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
export function win2nix(path) {
if (/^[A-Z]:/i.test(path)) {
Generated Vendored
+16 -2
View File
@@ -27729,13 +27729,13 @@ async function install(platform, engine, version) {
common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
if (!inToolCache) {
await downloadAndExtract(url, base, rubyPrefix);
await downloadAndExtract(engine, version, url, base, rubyPrefix);
}
return rubyPrefix
}
async function downloadAndExtract(url, base, rubyPrefix) {
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
const parentDir = path.dirname(rubyPrefix)
const downloadPath = await common.measure('Downloading Ruby', async () => {
@@ -27749,6 +27749,10 @@ async function downloadAndExtract(url, base, rubyPrefix) {
if (base !== path.basename(rubyPrefix)) {
await io.mv(path.join(parentDir, base), rubyPrefix)
}
if (common.shouldUseToolCache(engine, version)) {
common.createToolCacheCompleteFile(rubyPrefix)
}
}
async function setupMingw(version) {
@@ -32114,6 +32118,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVirtualEnvironmentName", function() { return getVirtualEnvironmentName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shouldUseToolCache", function() { return shouldUseToolCache; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getToolCacheRubyPrefix", function() { return getToolCacheRubyPrefix; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createToolCacheCompleteFile", function() { return createToolCacheCompleteFile; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "win2nix", function() { return win2nix; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setupPath", function() { return setupPath; });
const os = __webpack_require__(87)
@@ -32217,6 +32222,11 @@ function getToolCacheRubyPrefix(platform, version) {
return path.join(toolCache, 'Ruby', version, 'x64')
}
function createToolCacheCompleteFile(toolCacheRubyPrefix) {
const completeFile = `${toolCacheRubyPrefix}.complete`
fs.writeFileSync(completeFile, '')
}
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
function win2nix(path) {
if (/^[A-Z]:/i.test(path)) {
@@ -52982,6 +52992,10 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
await exec.exec('tar', ['-xz', '-C', parentDir, '-f', downloadPath])
}
})
if (common.shouldUseToolCache(engine, version)) {
common.createToolCacheCompleteFile(rubyPrefix)
}
}
function getDownloadURL(platform, engine, version) {
+4
View File
@@ -60,6 +60,10 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
await exec.exec('tar', ['-xz', '-C', parentDir, '-f', downloadPath])
}
})
if (common.shouldUseToolCache(engine, version)) {
common.createToolCacheCompleteFile(rubyPrefix)
}
}
function getDownloadURL(platform, engine, version) {
+6 -2
View File
@@ -53,13 +53,13 @@ export async function install(platform, engine, version) {
common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
if (!inToolCache) {
await downloadAndExtract(url, base, rubyPrefix);
await downloadAndExtract(engine, version, url, base, rubyPrefix);
}
return rubyPrefix
}
async function downloadAndExtract(url, base, rubyPrefix) {
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
const parentDir = path.dirname(rubyPrefix)
const downloadPath = await common.measure('Downloading Ruby', async () => {
@@ -73,6 +73,10 @@ async function downloadAndExtract(url, base, rubyPrefix) {
if (base !== path.basename(rubyPrefix)) {
await io.mv(path.join(parentDir, base), rubyPrefix)
}
if (common.shouldUseToolCache(engine, version)) {
common.createToolCacheCompleteFile(rubyPrefix)
}
}
async function setupMingw(version) {