Skip to content
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

Fedora, ruby 3.1 broken dependencies #469

Open
zmiklank opened this issue Mar 14, 2023 · 2 comments
Open

Fedora, ruby 3.1 broken dependencies #469

zmiklank opened this issue Mar 14, 2023 · 2 comments

Comments

@zmiklank
Copy link
Member

The build of the app for Fedora and ruby 3.1 is broken.

Reproducer:

  1. use following Dockerfile:
FROM quay.io/fedora/ruby-31:latest
ADD app-src ./
RUN bundle install --path ./bundle
CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080"
  1. download example app in the same directory where the Dockerfile is:
git clone https://github.com/sclorg/rails-ex.git app-src
  1. build the image
docker build --no-cache .

The build fails with:

STEP 1/4: FROM quay.io/fedora/ruby-31:latest
STEP 2/4: ADD app-src ./
--> 7c9e187471c
STEP 3/4: RUN bundle install --path ./bundle
[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local path './bundle'`, and stop using this flag
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Resolving dependencies...

CC @jackorp

@jackorp
Copy link
Contributor

jackorp commented Mar 14, 2023

Finally caught the culprit.

bundle install --frozen
[DEPRECATED] The `--frozen` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local frozen 'true'`, and stop using this flag
Fetching gem metadata from https://rubygems.org/..........
nokogiri-1.12.5-x86_64-linux requires ruby version < 3.1.dev, >= 2.5, which is incompatible with the current version, 3.1.3

So our problem is that nokogiri is resolved to that version. That version specifies < 3.1.dev and both bundler and Rubygems are apparently bad at resolving incompatible Ruby version. We need to get it to stop resolving to the nokogiri with the x86_64-linux suffix...

@jackorp
Copy link
Contributor

jackorp commented Mar 15, 2023

JFTR, we have discussed updating dependencies for rails-ex, that does not fix the issue, as Nokogiri still gets resolved the same. Any newer nokogiri drops support for Ruby 2.5, which then is results in unusable app for Ruby 2.5 containers.

I have filed https://bugzilla.redhat.com/show_bug.cgi?id=2178171 as it seems like a behavior regression in the bundler version shipped by Ruby 3.1.3.

What we can do (and probably will until fix comes into relevant Fedora Ruby streams), is either force all Gemfile.lock specified dependencies to use the Ruby platform by calling:
$ bundle config set force_ruby_platform true
Somewhere in tests.

or use a more fine-grained approach by specifying this config on a per-gem basis like so:

gem "nokogiri", :force_ruby_platform => true

hsbt pushed a commit to rubygems/rubygems that referenced this issue Jun 1, 2023
Instead of resolving to correct Ruby platform, it preferred the
archful package, that is actually incompatible.

See sclorg/s2i-ruby-container#469
for an example of the bug.

Commit taken from:
<#6225>
and adapted:
<7b64c64>
for the PR#6225.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants