Skip to content

Fix template postCommit for Ruby 2.7 / Bundler 2.2#140

Closed
yselkowitz wants to merge 1 commit intosclorg:masterfrom
multi-arch:samples
Closed

Fix template postCommit for Ruby 2.7 / Bundler 2.2#140
yselkowitz wants to merge 1 commit intosclorg:masterfrom
multi-arch:samples

Conversation

@yselkowitz
Copy link
Contributor

A change in behaviour in Ruby 2.7's included bundler results in an error
in the postCommit stage when attempting to build the templates:

LoadError: cannot load such file -- bundler/setup
/opt/app-root/src/config/boot.rb:3:in `require'
/opt/app-root/src/config/boot.rb:3:in `<top (required)>'
/opt/app-root/src/config/application.rb:1:in `require_relative'
/opt/app-root/src/config/application.rb:1:in `<top (required)>'
/opt/app-root/src/Rakefile:4:in `require_relative'
/opt/app-root/src/Rakefile:4:in `<top (required)>'
/opt/app-root/src/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `load'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:28:in `run'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:475:in `exec'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:31:in `dispatch'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:25:in `start'
/usr/share/gems/gems/bundler-2.2.24/libexec/bundle:46:in `block in <top (required)>'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
/usr/share/gems/gems/bundler-2.2.24/libexec/bundle:34:in `<top (required)>'
/opt/app-root/src/bin/bundle:3:in `load'
/opt/app-root/src/bin/bundle:3:in `<main>'

This, or a better fix, is needed urgently in order to proceed with the 4.10 imagestreams sync. Reverting the templates to 2.6 is not a great option given the upcoming EOL of that version.

/cc @phracek @pvalena @dperaza4dustbit @gabemontero

A change in behaviour in Ruby 2.7's included bundler results in an error
in the postCommit stage when attempting to build the templates:

LoadError: cannot load such file -- bundler/setup
/opt/app-root/src/config/boot.rb:3:in `require'
/opt/app-root/src/config/boot.rb:3:in `<top (required)>'
/opt/app-root/src/config/application.rb:1:in `require_relative'
/opt/app-root/src/config/application.rb:1:in `<top (required)>'
/opt/app-root/src/Rakefile:4:in `require_relative'
/opt/app-root/src/Rakefile:4:in `<top (required)>'
/opt/app-root/src/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `load'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli/exec.rb:28:in `run'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:475:in `exec'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:31:in `dispatch'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/cli.rb:25:in `start'
/usr/share/gems/gems/bundler-2.2.24/libexec/bundle:46:in `block in <top (required)>'
/usr/share/gems/gems/bundler-2.2.24/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
/usr/share/gems/gems/bundler-2.2.24/libexec/bundle:34:in `<top (required)>'
/opt/app-root/src/bin/bundle:3:in `load'
/opt/app-root/src/bin/bundle:3:in `<main>'
],
"postCommit": {
"script": "bundle exec rake test"
"script": "/usr/bin/bundle exec rake test"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find @yselkowitz thanks for researching this one

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing on my PR on sample and will report here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now on openshift/cluster-samples-operator#408 rail test is not failing. Still see some other errors but this fix seems to be working

yselkowitz added a commit to yselkowitz/origin that referenced this pull request Jan 19, 2022
yselkowitz added a commit to yselkowitz/origin that referenced this pull request Jan 19, 2022
yselkowitz added a commit to yselkowitz/origin that referenced this pull request Jan 19, 2022
@pvalena
Copy link
Member

pvalena commented Jan 19, 2022

@yselkowitz Doesn't #134 fix this?

@pvalena
Copy link
Member

pvalena commented Jan 19, 2022

Otherwise LGTM. Please note that this will not work for the SCL images though.

@phracek
Copy link
Member

phracek commented Jan 19, 2022

It looks like s2i-ruby-container does not use this repo at all. See https://github.com/sclorg/s2i-ruby-container/blob/master/test/test-lib-ruby.sh. From SCL images point of view. It looks good.

@yselkowitz
Copy link
Contributor Author

Not sure about #134 relative to this, but how far out is that from being merged? We need the template working immediately.

@yselkowitz
Copy link
Contributor Author

Turns out this isn't enough, as migrate-database.sh also contains a bundle exec call and is used in the template. Is #134 the only way to fix rails-ex for Ruby 2.7+?

@pvalena
Copy link
Member

pvalena commented Jan 20, 2022

@yselkowitz from my POV, #134 is all good to go (I didn't want to merge on holidays, and didn't get to it since) -

@yselkowitz thanks to @jackorp the issue should be fixed now. Please fire any OpenShift tests, otherwise we'll rely on s2i-ruby-container to do them, after we merge this.

We can merge right away, if you don't see any conflicts.

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

Successfully merging this pull request may close these issues.

4 participants

Comments