setup-ruby
setup-ruby copied to clipboard
How to use this action for multiple runners running on same host
Hello Team,
Our use case is to use this action on multiple self hosted runners running on single host.
Runners are running in different directory and trying to access cache from default location (Users/runner/hostedtoolcache) and with multiple runners executing same step we are getting raise condition while installing cocoapods e.t.c.
Any recommendation how to override default cache location for multiple runners running in same host ?
Wow. I actually have the exact same question and was coming here to post it. Glad I'm not the only one. My GitHub actions workflow constantly gives me the same error when two are running at the same time:
Run ruby/setup-ruby@v1
Modifying PATH
Downloading Ruby
Extracting Ruby
Print Ruby version
Installing Bundler
bundle install
Error: Error: The process '/opt/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle' failed with exit code 1
at ExecState._setResult (/home/ubuntu/actions-runner/_work/_actions/ruby/setup-ruby/v1/dist/index.js:6023:25)
at ExecState.CheckComplete (/home/ubuntu/actions-runner/_work/_actions/ruby/setup-ruby/v1/dist/index.js:6006:1[8](https://github.com/vonahisec/goku/actions/runs/3191254271/jobs/5207340447#step:8:9))
at ChildProcess.<anonymous> (/home/ubuntu/actions-runner/_work/_actions/ruby/setup-ruby/v1/dist/index.js:5900:[27](https://github.com/vonahisec/goku/actions/runs/3191254271/jobs/5207340447#step:8:33))
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
Since it's been 2 weeks, have you figured out any solution by chance @ombuildandprice?
It could work if the runners were started inside a chroot. That way they would be isolated and have different /opt/ directories.
You could disable the concurrence of the same workflow in different runners, something similar to this workflows and references
.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
The built Rubies hardcode the PATH in which they were built, so they cannot be stored anywhere, so the toolcache path is fixed and cannot change.
The only solution I can see would be to do inter-process locking, but I think that's going to come with a lot of complexity and I have no plan to work on it. If there is a clean enough PR adding it I'll consider it.
I'll close this as not planned. As said above, if there is a clean enough PR adding it I'll consider it.
Duplicate of https://github.com/ruby/setup-ruby/issues/191, follow updates there.