Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.50.0 Fails gem install (can't find the ruby) #104

Closed
mrGrazy opened this issue Nov 9, 2020 · 7 comments
Closed

v1.50.0 Fails gem install (can't find the ruby) #104

mrGrazy opened this issue Nov 9, 2020 · 7 comments

Comments

@mrGrazy
Copy link

mrGrazy commented Nov 9, 2020

The most recent release seems to have broken the install of ruby.

The setup ruby action is failing with

/home/runner/_work/_tool/Ruby/2.6.3/x64/bin/gem install bundler -v ~> 1 --no-document
  Took   0.00 seconds
Error: There was an error when attempting to execute the process '/home/runner/_work/_tool/Ruby/2.6.3/x64/bin/gem'. This may indicate the process failed to start. Error: spawn /home/runner/_work/_tool/Ruby/2.6.3/x64/bin/gem ENOENT

When I try running that command again on the runners I see this error:

runner@runner-pool-pod-bp4zt:~$ /home/runner/_work/_tool/Ruby/2.6.3/x64/bin/gem install bundler -v ~> 1 --no-document
bash: /home/runner/_work/_tool/Ruby/2.6.3/x64/bin/gem: /opt/hostedtoolcache/Ruby/2.6.3/x64/bin/ruby: bad interpreter: No such file or directory

So it looks like the recent change to related to hostedtoolcache is affecting the paths to ruby, but I don't know if we're supposed to be doing something different.

@mrGrazy
Copy link
Author

mrGrazy commented Nov 9, 2020

Sorry after reading #98 we've worked out that this is because of RUNNER_TOOL_CACHE is not present on our self hosted runners.
Haven't worked out how to set that correctly in a way that doesn't just crash the runner agent, but that's our problem. 🤦

@mrGrazy mrGrazy closed this as completed Nov 9, 2020
@MSP-Greg
Copy link
Collaborator

MSP-Greg commented Nov 9, 2020

By chance, how about AGENT_TOOLSDIRECTORY? It has the same value on the GH Ubuntu runners...

@eregon
Copy link
Member

eregon commented Nov 9, 2020

The action actually checks that the env var is defined:

setup-ruby/common.js

Lines 67 to 70 in 0592d01

const toolCache = process.env['RUNNER_TOOL_CACHE']
if (!toolCache) {
throw new Error('$RUNNER_TOOL_CACHE must be set')
}

Maybe it is set incorrectly in your case, or not set?
The value will need to be the same as on GitHub runners, since Ruby captures the absolute paths in various places when it's built:
#98 (comment)

@eregon
Copy link
Member

eregon commented Nov 10, 2020

Maybe we should hardcode the path for the 3 platforms?
Then it should work no matter what $RUNNER_TOOL_CACHE is set to.
Then tc.find() from https://github.com/actions/toolkit/tree/main/packages/tool-cache, which we will use in the future, would look in $RUNNER_TOOL_CACHE and potentially find custom builds of Ruby, and if not, the prebuilt ruby would be downloaded under the right path and work fine.

@shoukoo
Copy link

shoukoo commented Nov 10, 2020

Just want to share some info, I need do the following in order to make the latest setup-ruby(v1.50.0) works in our self-hosted runners.

  • Changed the owner from root to runner for the /opt/hostedtoolcache dir
  • Set RUNNER_TOOL_CACHE in the runner's .env file.

@eregon
Copy link
Member

eregon commented Nov 10, 2020

After some thoughts, I don't want to deal with RUNNER_TOOL_CACHE not being the same as on GitHub-hosted runners, as it brings a lot of complications.

I documented these requirements in 8e77d9e, feel free to improve the docs with a PR.

@eregon
Copy link
Member

eregon commented Nov 10, 2020

I changed my mind, and hardcoded the paths in ba761ba and update the requirements in the README.
That should work better if $RUNNER_TOOL_CACHE is set to another value, and result in a clearer error if e.g. the directory is not writable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants