setup-ruby: Ruby 2.3 to 2.5 can't install bundler
Ensure the following before filing this issue
-
I verified it reproduces with the latest version with
- uses: ruby/setup-ruby@v1(see Versioning policy) -
I tried to reproduce the issue locally by following the workflow steps (including all commands done by
ruby/setup-ruby, except forDownloading Ruby&Extracting Ruby), and it did not reproduce locally (if it does reproduce locally, it’s not a ruby/setup-ruby issue)
Are you running on a GitHub-hosted runner or a self-hosted runner?
GitHub-hosted runner
The workflow code or a link to the workflow file
https://github.com/MaxLap/activerecord_where_assoc/blob/master/.github/workflows/run_tests.yml
Link to the log of a failed workflow job, or to a gist with the output
https://github.com/MaxLap/activerecord_where_assoc/actions/runs/3771542199/jobs/6412280221
The command and output of the failing step
On a Ruby 2.3 to 2.5 installation (I tested the command with ruby 2.4.10p364 locally and have the same problem):
gem install bundler -v '~> 2.0'
ERROR: Error installing bundler:
The last version of bundler (~> 2.0) to support your Ruby & RubyGems was 2.3.26. Try installing it with `gem install bundler -v 2.3.26`
bundler requires Ruby version >= 2.6.0. The current ruby version is 2.4.10.364.
### Any other notes?
I know since I can reproduce locally, you say it's not a setup-ruby bug, but I think in this case, it is, since it seems setup-ruby is using the wrong command in that case.
Bundler 2.4.0 was just released, which has a minimum Ruby version of 2.6.
The default bundle installation command of `gem install bundler -v '~> 2.0'` doesn't work on those Ruby version because it seems `gem install` only uses the `~= 2.0` to pick the latest version, not necessarily one that is compatible with the current Ruby.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (12 by maintainers)
Commits related to this issue
- Test with Ruby 3.2 Do not try to install latest RubyGems due to https://github.com/ruby/setup-ruby/issues/422 — committed to spinels/overman by dentarg 2 years ago
Please do not release an incompatibile Bundler change on Christmas 😕 I don’t think it’s acceptable to slow down workflows by updating RubyGems or do it behind the user’s back. Adding a Bundler version constraint seems fine.
Bundler should have used a new major version (3.0) for such a change, that would not have broken things needlessly (it reminds me of Bundler 2.0).
Ideally, whatever fix done wouldn’t require every repo using
setup-rubyon older rubies to change their config.A safe way, altho somewhat dirty, could be to add a “< 2.4” to the version requirement when ruby is less than 2.6. There are already a few special cases in the code for installing bundler, so that doesn’t seem too terrible.
gem install bundler -v '~> 2.0, < 2.4'appears to work locally.https://github.com/ruby/setup-ruby/releases/tag/v1.129.0
To expand on https://github.com/ruby/setup-ruby/issues/422#issuecomment-1364565462 which was apparently not well received but was intended to just be factual.
I do support dropping support for EOL Rubies in gems, and my opinion is this does not require a major version of the gem (which would just be extra maintenance effort unwarranted for it). However, that’s if
required_ruby_versionworks, otherwise a new major version seems necessary.Here we knew
required_ruby_versiondid not work well. And that various usages including setup-ruby didgem install ~> 2notably to protect from a Bundler 3 dropping support for older Rubies. So it would have just worked if it was Bundler 3.0. But instead we annoy a bunch of open-source maintainers on Christmas eve and day, that’s unfortunate.I guess we need to give a version to Bundler inside ruby/ruby at 3.2 release. But I think it would be much more helpful to release big changes like dropping old Ruby versions before Christmas, say 1-2 weeks before when people can react to it without interrupting their holidays (e.g., I can literally not release setup-ruby from my phone). So we would have 2.4.0 ~2 weeks ago (i.e., after https://github.com/rubygems/rubygems/commit/77e7b79d657c20ecb0dccc73d38d180accf90aac) and then some 2.4.1/2.4.2 on Ruby 3.2.0 release date. Here is to hoping we can avoid breaking changes at this time of the year in the future.
We were aware of this potential issue and decided no to cut major versions for this kind of incompatibility that only affects combinations of old rubies + old rubygems. We decided to do this for Christmas release also intentionally.
Had I recalled issues like https://github.com/ruby/setup-ruby/issues/228 though, where the warning we’ve been giving for a year was brought up, I would have proposed an update to ruby/setup-ruby, but I missed it 😦 Of course, you could’ve also updated this yourself, specially since you were part of the original discussion where we added the warning about this in Bundler. We are all humans and forget things, make mistakes, or make intentional decisions that others see as bad decisions. It happens!
Fortunately, in this case, it should be easy to change things so that most users don’t notice anything.
Anyways, I’m sorry the way we maintain our libraries doesn’t please you. I have to say I do get tired of so much negativity from you side Benoit, and that’s very rare in our community, so I’m not really used to it and it sucks my energy. Because of that, I will unsubscribe from this post now. Happy Christmas!