pre-commit-ci / issues

public issues for https://pre-commit.ci
16 stars 3 forks source link

rbenv cannot install ruby versions on jammy #151

Closed mishaschwartz closed 1 year ago

mishaschwartz commented 1 year ago

When using a hook with a ruby language version that is not the system default, the new ruby version is installed with rbenv.

Unfortunately, the environment installation fails with a timeout error. Here is an example:

https://results.pre-commit.ci/run/github/940538/1667315316.aRFFEnClSrmfN0PNC6wuqg

While trying to re-create the issue, I realized two problems:

  1. yes this seems to take a long time (much longer than 120 seconds on my system). Is there a way to increase the timeout or cache some intermediate step so that the environment creation doesn't time out.

  2. installing ruby 2.7 (or any version <3.1) on jammy fails because the wrong version of openssl is installed by default (see https://github.com/rbenv/ruby-build/discussions/1940#discussioncomment-2519546 for more details). Is there a way to configure the image to install a newer version of ruby-build which should solve this issue.

I realize that 2. might be better solved with an update to the https://github.com/pre-commit/pre-commit repository but since this bug is caused by the recent upgrade to jammy in this repository I thought I'd add it here first.

asottile commented 1 year ago

I've moved the issue to the right place

for (1) I'd recommend using the default ruby if possible -- extending the timeout for building invites mining abuse

for (2) feel free to send a PR to pre-commit/pre-commit -- though there's some backend changes to pre-commit.ci that need to happen before it can be released and rolled out due to the unreleased changes to rust

the other option would be to choose a prebuilt version of ruby for 22.04 -- those come from rvm usually

since there isn't anything actionable here -- going to close this out for now

mishaschwartz commented 1 year ago

Ok thanks I understand. I'll look into the pre-commit/pre-commit repo and attempt a PR there.

I don't love the idea of having to use a different ruby version in a CI environment than I am in my other environments but since it's just for rubocop it might be ok for just this case.

Also, do you mind adding a note somewhere for us pre-commit-ci users that certain ruby version are currently not supported though, I can't imagine I'm the only one who will run into this.

asottile commented 1 year ago

it seems also that rvm may no longer be pushing prebuilt binaries -- it may make sense for us to start providing those 🤔

if you're interested we could collaborate on building a solution for this -- I'm thinking a small rbenv plugin similar to the ruby-build one but uses github packages / artifacts as a backend?

mishaschwartz commented 1 year ago

I just made a PR that seems to be working to get ruby 2.7 installed on jammy at least...

mishaschwartz commented 1 year ago

I'd be interested in collaborating on a more robust solution though, let me know how I can help and I'll contribute when/where I can