8000 Explain why it was detected as self-hosted · ruby/setup-ruby@5a73aa9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a73aa9

Browse files
committed
Explain why it was detected as self-hosted
1 parent d01c52a commit 5a73aa9

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

common.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@ export function isSelfHostedRunner() {
179179
getRunnerToolCache() !== getDefaultToolCachePath()
180180
}
181181

182+
export function selfHostedRunnerReason() {
183+
if (inputs.selfHosted === 'true') {
184+
return 'the self-hosted input was set'
185+
} else if (!GitHubHostedPlatforms.includes(getOSNameVersionArch())) {
186+
return 'the platform does not match a GitHub-hosted runner image (or that image is deprecated and no longer supported)'
187+
} else if (getRunnerToolCache() !== getDefaultToolCachePath()) {
188+
return 'the $RUNNER_TOOL_CACHE is different than the default tool cache path (they must be the same to reuse prebuilt Ruby binaries)'
189+
} else {
190+
return 'unknown reason'
191+
}
192+
}
193+
182194
let virtualEnvironmentName = undefined
183195

184196
export function getVirtualEnvironmentName() {

dist/index.js

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ruby-builder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export async function install(platform, engine, version) {
2828
if (common.isSelfHostedRunner()) {
2929
const rubyBuildDefinition = engine === 'ruby' ? version : `${engine}-${version}`
3030
core.error(
31-
`The current runner (${common.getOSNameVersionArch()}, RUNNER_TOOL_CACHE=${common.getRunnerToolCache()}) was detected as self-hosted and not matching a GitHub-hosted runner image.\n` +
32-
`In such a case, you should install Ruby in the $RUNNER_TOOL_CACHE yourself, for example using https://github.com/rbenv/ruby-build:\n` +
31+
`The current runner (${common.getOSNameVersionArch()}, RUNNER_TOOL_CACHE=${common.getRunnerToolCache()}) was detected as self-hosted because ${common.selfHostedRunnerReason()}.\n` +
32+
`In such a case, you should install Ruby in the $RUNNER_TOOL_CACHE yourself, for example using https://github.com/rbenv/ruby-build\n` +
3333
`You can take inspiration from this workflow for more details: https://github.com/ruby/ruby-builder/blob/master/.github/workflows/build.yml\n` +
3434
`$ ruby-build ${rubyBuildDefinition} ${toolCacheRubyPrefix}\n` +
3535
`Once that completes successfully, mark it as complete with:\n` +

0 commit comments

Comments
 (0)
0