Skip to content

Ruby 2.3.0 bundler failing after PR #146 just merged #148

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

Closed
waltjones opened this issue Jan 26, 2021 · 11 comments · Fixed by #149
Closed

Ruby 2.3.0 bundler failing after PR #146 just merged #148

waltjones opened this issue Jan 26, 2021 · 11 comments · Fixed by #149

Comments

@waltjones
Copy link

#146 is failing for me on Ruby 2.3.0:

Run ruby/setup-ruby@v1
Downloading Ruby
Extracting Ruby
Installing Bundler
  /opt/hostedtoolcache/Ruby/2.3.0/x64/bin/gem install bundler -v ~> 2 --no-document
  ERROR:  Error installing bundler:
  	bundler requires RubyGems version >= 2.5.2. Try 'gem update --system' to update RubyGems itself.
  Took   0.39 seconds
Error: The process '/opt/hostedtoolcache/Ruby/2.3.0/x64/bin/gem' failed with exit code 1

My github action is straightforward:

uses: ruby/setup-ruby@v1
with:
  ruby-version: 2.3.0
@bpinto
Copy link
Contributor

bpinto commented Jan 26, 2021

@waltjones Could it be that your Gemfile.lock does not have a bundler version specified? If that's the case you could force it to use version 1 as it was previously with:

        with:
          ruby-version: 2.3
          bundler: '1' # Force ruby version

@bpinto
Copy link
Contributor

bpinto commented Jan 26, 2021

Looking at https://github.com/rollbar/rollbar-gem/blob/master/.github/workflows/ci.yml I think of two ways to handle it.

  1. Split step Setup Ruby > 2.0 one for ruby >= 2.4 and other for lower versions.
  2. Including bundler version in matrix. I see you are already using include there, so you would use it to add bundler: 'default' or bundler: '1'.

@bpinto
Copy link
Contributor

bpinto commented Jan 26, 2021

This patch tries to implement (2) above. I haven't tested it.

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b1736dd..f0ba947 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -12,6 +12,7 @@ jobs:
     strategy:
       matrix:
         ruby-version: [2.2.10, 2.3.0, 2.3.8, 2.4.5, 2.5.3, 2.6.0]
+        bundler-version: 'default'
         gemfile:
           - gemfiles/rails42.gemfile
           - gemfiles/rails50.gemfile
@@ -32,6 +33,9 @@ jobs:
           - gemfile: gemfiles/rails60.gemfile
             ruby-version: 2.4.5
         include:
+          - gemfile: gemfiles/rails52.gemfile
+            ruby-version: 2.3.0
+            bundler-version: '1'
           - gemfile: gemfiles/rails41.gemfile
             ruby-version: 2.3.0
           - gemfile: gemfiles/rails41.gemfile
@@ -67,6 +71,7 @@ jobs:
         uses: ruby/setup-ruby@v1
         if: ${{ matrix.ruby-version != '2.0.0' }}
         with:
+          bundler: ${{ matrix.bundler-version }}
           ruby-version: ${{ matrix.ruby-version }}
 
       - name: Setup Ruby 2.0.0

@bpinto
Copy link
Contributor

bpinto commented Jan 26, 2021

Meanwhile, I'm trying to figure out if it's only ruby 2.3.0 that's failing, I have confirmed it works on ruby 2.3.3.

@waltjones
Copy link
Author

@bpinto Many thanks. I agree this looks like it would work. I'll try it.

@eregon
Copy link
Member

eregon commented Jan 26, 2021

Right, it sounds like Ruby 2.3.0 shipped with a too old RubyGems.

Please use Ruby 2.3.3 in Windows (

"2.3.3": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.3-x64-mingw32.7z",
) and Ruby 2.3.8 on Linux/macOS, or simply use ruby-version: 2.3.

@bpinto
Copy link
Contributor

bpinto commented Jan 26, 2021

@eregon I haven't been able to confirm ruby 2.3.0 is the only affected yet, but would you like me to submit another PR forcing bundler: '1' on ruby 2.3.0 specifically?

diff --git a/bundler.js b/bundler.js
index 349c323..393d165 100644
--- a/bundler.js
+++ b/bundler.js
@@ -72,6 +72,9 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
   if (engine === 'ruby' && rubyVersion.match(/^2\.[012]/)) {
     console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
     bundlerVersion = '1'
+  } else if (engine === 'ruby' && rubyVersion === '2.3.0') {
+    console.log('Ruby 2.3.0 has shipped with an old rubygems and only works with Bundler 1')
+    bundlerVersion = '1'
   } else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
     console.log('JRuby 9.1 has a bug with Bundler 2 (https://github.com/ruby/setup-ruby/issues/108), using Bundler 1 instead on JRuby 9.1')
     bundlerVersion = '1'

@eregon
Copy link
Member

eregon commented Jan 26, 2021

I'll test here to see which 2.3.x versions are affected:
https://github.com/eregon/setup-ruby/actions/runs/512656033
https://github.com/eregon/setup-ruby/actions/runs/512658078
https://github.com/eregon/setup-ruby/actions/runs/512665030

@bpinto
Copy link
Contributor

bpinto commented Jan 26, 2021

Based on your test results it seems only 2.3.0 and 2.3.1 are affected.

diff --git a/bundler.js b/bundler.js
index 349c323..e652755 100644
--- a/bundler.js
+++ b/bundler.js
@@ -72,6 +72,9 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
   if (engine === 'ruby' && rubyVersion.match(/^2\.[012]/)) {
     console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
     bundlerVersion = '1'
+  } else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) {
+    console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
+    bundlerVersion = '1'
   } else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
     console.log('JRuby 9.1 has a bug with Bundler 2 (https://github.com/ruby/setup-ruby/issues/108), using Bundler 1 instead on JRuby 9.1')
     bundlerVersion = '1'

@eregon
Copy link
Member

eregon commented Jan 26, 2021

Yes, indeed, could you make a PR with that?

Ruby 2.3.0 and 2.3.1 have RubyGems 2.5.1, Ruby 2.3.2+ have RubyGems 2.5.2+.

@eregon
Copy link
Member

eregon commented Jan 26, 2021

Fixed and released in https://github.com/ruby/setup-ruby/releases/tag/v1.64.1

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

Successfully merging a pull request may close this issue.

3 participants