Open rafalhejna opened 1 month ago
Hi @rafalhejna , We will analyse the issue and provide the solution, thanks
Hi @rafalhejna , Could you please retry the same and share the snippet/workflow file is any errors. thanks
@vidyasagarnimmagaddi The issue is still present. I haven't done enough research into it, so my recreation steps are not quite correct. Below please find sample workflow and Gemfile files, that will cause the same issue.
workflow.yml
name: 'Ruby test'
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler: 2.5.13
env:
BUNDLE_GEMFILE: Gemfile
- name: bundle install
run: bundle install
Gemfile
source 'https://rubygems.org'
gem 'faraday'
Hi @rafalhejna , the above provided workflow , successful at our end,. Follow below steps
If not move to the Gemfile location and try to run .
run: |
cd ${{ github.workspace }}
bundle install
shell: bash
@vidyasagarnimmagaddi Still the same error. Here's my workflow file
name: 'Ruby test'
on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
working-directory: ./ruby-test
env:
BUNDLE_GEMFILE: Gemfile
- name: bundle install
run: |
cd ruby-test
gem install bundler -v 2.5.13
bundle install
shell: bash
And here is the output log
2024-07-15T15:31:34.0859573Z Current runner version: '2.317.0' 2024-07-15T15:31:34.0885887Z ##[group]Operating System 2024-07-15T15:31:34.0886507Z Ubuntu 2024-07-15T15:31:34.0886969Z 22.04.4 2024-07-15T15:31:34.0887288Z LTS 2024-07-15T15:31:34.0887611Z ##[endgroup] 2024-07-15T15:31:34.0887946Z ##[group]Runner Image 2024-07-15T15:31:34.0888478Z Image: ubuntu-22.04 2024-07-15T15:31:34.0888872Z Version: 20240708.1.0 2024-07-15T15:31:34.0889929Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20240708.1/images/ubuntu/Ubuntu2204-Readme.md 2024-07-15T15:31:34.0891336Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20240708.1 2024-07-15T15:31:34.0892181Z ##[endgroup] (...) 2024-07-15T15:31:36.2826476Z ##[group]Run ruby/setup-ruby@v1 2024-07-15T15:31:36.2826925Z with: 2024-07-15T15:31:36.2827335Z ruby-version: 3.2 2024-07-15T15:31:36.2827665Z working-directory: ./ruby-test 2024-07-15T15:31:36.2828073Z bundler-cache: false 2024-07-15T15:31:36.2828485Z env: 2024-07-15T15:31:36.2828780Z BUNDLE_GEMFILE: Gemfile 2024-07-15T15:31:36.2829146Z ##[endgroup] 2024-07-15T15:31:36.5000307Z ##[group]Modifying PATH 2024-07-15T15:31:36.5051966Z Entries added to PATH to use selected Ruby: 2024-07-15T15:31:36.5052956Z /opt/hostedtoolcache/Ruby/3.2.4/x64/bin 2024-07-15T15:31:36.5054079Z ##[endgroup] 2024-07-15T15:31:36.5055101Z ##[group]Print Ruby version 2024-07-15T15:31:36.5056095Z [command]/opt/hostedtoolcache/Ruby/3.2.4/x64/bin/ruby --version 2024-07-15T15:31:36.7928677Z ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-linux] 2024-07-15T15:31:36.7967094Z Took 0.38 seconds 2024-07-15T15:31:36.7973298Z ##[endgroup] 2024-07-15T15:31:36.7974295Z ##[group]Installing Bundler 2024-07-15T15:31:36.7975405Z Using Bundler 2 shipped with ruby-3.2.4 2024-07-15T15:31:36.7976128Z Took 0.00 seconds 2024-07-15T15:31:36.7977470Z ##[endgroup] 2024-07-15T15:31:36.8088188Z ##[group]Run cd ruby-test 2024-07-15T15:31:36.8088640Z [36;1mcd ruby-test[0m 2024-07-15T15:31:36.8089067Z [36;1mgem install bundler -v 2.5.13[0m 2024-07-15T15:31:36.8089625Z [36;1mbundle install[0m 2024-07-15T15:31:36.8135404Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} 2024-07-15T15:31:36.8136066Z ##[endgroup] 2024-07-15T15:31:38.2230565Z Successfully installed bundler-2.5.13 2024-07-15T15:31:38.2231843Z 1 gem installed 2024-07-15T15:31:39.2517623Z Fetching gem metadata from https://rubygems.org/........ 2024-07-15T15:31:39.6319014Z Resolving dependencies... 2024-07-15T15:31:39.6616629Z Installing logger 1.6.0 2024-07-15T15:31:39.6620372Z Installing uri 0.13.0 2024-07-15T15:31:39.6766090Z Installing net-http 0.4.1 2024-07-15T15:31:39.6863774Z The installation path is insecure. Bundler cannot continue. 2024-07-15T15:31:39.6864804Z /opt/hostedtoolcache/Ruby/3.2.4/x64/lib/ruby/gems/3.2.0/gems is world-writable 2024-07-15T15:31:39.6870220Z (without sticky bit). 2024-07-15T15:31:39.6872331Z Bundler cannot safely replace gems in world-writeable directories due to 2024-07-15T15:31:39.6873502Z potential vulnerabilities. 2024-07-15T15:31:39.6874454Z Please change the permissions of this directory or choose a different install 2024-07-15T15:31:39.6875610Z path. 2024-07-15T15:31:39.7095068Z ##[error]Process completed with exit code 38.
Hi @rafalhejna , the issue is due to the permissions.Kindly try this.
name: 'Ruby test'
on:
push
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
working-directory: ./ruby-test
env:
BUNDLE_GEMFILE: Gemfile
- name: Change permissions
run: chmod -R o-w /opt/hostedtoolcache/Ruby/3.2.4/x64/lib/ruby/gems/3.2.0/gems
- name: bundle install
run: |
cd ruby-test
gem install bundler -v 2.5.13
bundle install
shell: bash
@vidyasagarnimmagaddi So your suggestion worked, but this solution looks rather "hacky". Is it really the only way to make this work? Can this setting be applied more "globally" to all runners?
This is a real challenge to do if you happen to be using a matrix build with many different versions of ruby.
This is a real challenge to do if you happen to be using a matrix build with many different versions of ruby.
This is exactly what we are encountering. We were able to just be quite a bit more liberal in our chmod
usage, though:
chmod -R o-w /opt/hostedtoolcache/Ruby
That seemed to do the trick for us.
This seems a bug of the prebuilt Ruby 3.2.4 in the toolcache, where it got wrong permissions.
Since https://github.com/ruby/setup-ruby/issues/98 the expectation is the binaries from https://github.com/ruby/ruby-builder are used.
https://github.com/eregon/actions-shell/actions/runs/10199673790/job/28217339098 shows that indeed the permissions are wrong:
$ ls -la /opt/hostedtoolcache/Ruby/3.2.4/x64/lib/ruby/gems/3.2.0/gems
total 352
drwxrwxrwx+ 88 runner docker 4096 Apr 23 13:04 .
drwxrwxrwx+ 9 runner docker 4096 Apr 23 13:04 ..
drwxrwxrwx+ 2 runner docker 4096 Apr 23 13:04 abbrev-0.1.1
drwxrwxrwx+ 2 runner docker 4096 Apr 23 13:04 base64-0.1.1
...
That should be fixed in the scripts creating the runner images (i.e., this repo).
https://github.com/ruby/ruby-builder/releases/download/toolcache/ruby-3.2.4-ubuntu-22.04.tar.gz has the correct permissions, see https://github.com/ruby/setup-ruby/issues/624#issuecomment-2263113830
OTOH it seems the permissions are wrong for everything under /opt/hostedtoolcache
on all 3 ubuntu versions:
https://github.com/eregon/actions-shell/actions/runs/10199733618/job/28217556337
Run ls -la /opt/hostedtoolcache
total 36
drwxrwxrwx+ 9 runner root 4096 Jul 21 22:30 .
drwxrwxrwx+ 17 root root 4096 Aug 1 13:49 ..
drwxrwxrwx+ 3 runner root 4096 Jul 21 21:20 CodeQL
drwxrwxrwx+ 6 runner root 4096 Jul 21 21:40 Java_Temurin-Hotspot_jdk
drwxrwxrwx+ 8 runner runneradmin 4096 Jul 21 22:23 PyPy
drwxrwxrwx+ 8 runner runneradmin 4096 Jul 21 22:29 Python
drwxrwxrwx+ 5 runner root 4096 Jul 21 22:00 Ruby
drwxrwxrwx+ 5 runner runneradmin 4096 Jul 21 22:30 go
drwxrwxrwx+ 5 runner runneradmin 4096 Jul 21 22:29 node
I don't know if that is new or it was always like that.
Description
Running
bundle install
is fine when we're using the non-cached version of Ruby on the previous Ubuntu runner image versionBut, when using the same Ruby version on the latest ubuntu-22.04 image (which is cached now), the same process fails:
Platforms affected
Runner images affected
Image version and build link
20240708.1.0
Is it regression?
Yes, it worked on 20240630.1.0
Expected behavior
bundle install
is successfulActual behavior
bundle install
failsRepro steps
ubuntu-latest
as a runner imagesetup-ruby@v1
step with version 3.2 of Rubybundle install
step