Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2058266

Summary: [sig-devex][Feature:ImageEcosystem][ruby][Slow] hot deploy for openshift ruby image Rails example should work with hot deploy
Product: OpenShift Container Platform Reporter: Surender Yadav <suryadav>
Component: SamplesAssignee: David Peraza <dperaza>
Status: CLOSED CURRENTRELEASE QA Contact: Jitendar Singh <jitsingh>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.10CC: aos-bugs, dgoodwin, dmistry, dperaza, jar.prokop, jprokop, pvalena, yselkowi
Target Milestone: ---   
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-01 17:09:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Surender Yadav 2022-02-24 15:39:18 UTC
Description of problem: The image-ecosystem job is failing with test "[sig-devex][Feature:ImageEcosystem][ruby][Slow] hot deploy for openshift ruby image Rails example should work with hot deploy" for all the versions.

Version-Release number of selected component (if applicable): 4.10 to 4.6

How reproducible:

https://search.ci.openshift.org/?search=The+build+%22rails-postgresql-example-1%22+status+is+%22Failed%22&maxAge=336h&context=1&type=bug%2Bjunit&name=s390x&excludeName=&maxMatches=5&maxBytes=20971520&groupBy=job

https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/periodic-ci-openshift-multiarch-master-nightly-4.10-ocp-image-ecosystem-remote-libvirt-s390x/1496726636412801024

This failure is noticed on CI of other platforms as well for Image ecosystem Job: 

https://search.ci.openshift.org/?search=The+build+%22rails-postgresql-example-1%22+status+is+%22Failed%22&maxAge=336h&context=1&type=bug%2Bjunit&name=ppc64le&excludeName=&maxMatches=5&maxBytes=20971520&groupBy=job

https://search.ci.openshift.org/?search=The+build+%22rails-postgresql-example-1%22+status+is+%22Failed%22&maxAge=336h&context=1&type=bug%2Bjunit&name=aws&excludeName=&maxMatches=5&maxBytes=20971520&groupBy=job

Also associated test "[sig-devex][Feature:ImageEcosystem][Slow] openshift sample application repositories [sig-devex][Feature:ImageEcosystem][ruby] test ruby images with rails-ex db repo Building rails-postgresql app from new-app should build a rails-postgresql image and run it in a pod" with this image is also failing.

Actual results:
Test Fails

Expected results:
Test should pass

Comment 1 Yaakov Selkowitz 2022-02-25 15:17:14 UTC
This is caused by an apparent incompatibility between https://github.com/sclorg/rails-ex/pull/134 with Ruby <2.7.  In order to be compatible with recent Rails versions, the s2i assemble script now generates a master key when none is present.  That is done by calling a rake command, but ruby-26's rake is apparently too old:

$ s2i build https://github.com/sclorg/rails-ex registry.redhat.io/ubi8/ruby-26 rails-ex:2.6
[snip]
---> No master key present in environment, generating ...
/usr/share/gems/gems/bundler-1.17.2/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find rake-13.0.3 in any of the sources (Bundler::GemNotFound)
[snip]
---> Starting asset compilation ...
rake aborted!
ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `bin/rails credentials:edit`

One workaround would be to update the rails templates to ruby:2.7-ubi8, but ideally the repo should work with all supported ruby versions.  I was going to investigate this but got pulled off to higher priority items.  Pavel, Jaroslav, could you PTAL?

Comment 2 Pavel Valena 2022-02-28 12:45:28 UTC
Firstly, we've run multiple tests, and it also works for openshift tests on s2i-ruby-container. Please verify if the tests on s2i-ruby-container cover your use-case.

This is related to regenerating the secret key change. The true error occures before this in the log (please attach full logs; it's impossible to be found in the links you've added).

https://github.com/sclorg/rails-ex/issues/146

Comment 3 Pavel Valena 2022-02-28 12:59:57 UTC
(In reply to Yaakov Selkowitz from comment #1)
> This is caused by an apparent incompatibility between
> https://github.com/sclorg/rails-ex/pull/134 with Ruby <2.7.  In order to be
> compatible with recent Rails versions, the s2i assemble script now generates
> a master key when none is present.  That is done by calling a rake command,
> but ruby-26's rake is apparently too old:
> 

FTR I don't think it's true. The issue is that it fails to install to the requested (default) location. Please note that running rails-ex manually in the container with rails-ex app still works:

###
+ bundle install --path vendor
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/..........
Fetching rake 13.0.3
Installing rake 13.0.3
Fetching concurrent-ruby 1.1.8
Installing concurrent-ruby 1.1.8
Fetching i18n 1.8.10
Installing i18n 1.8.10
Fetching minitest 5.14.4
[ . . . ]
###
rake just happens to be first to be installed (whole installation fails).

So this is just probably dependent on the environment (or the 'vendor' destination is not writable?).

https://gist.github.com/bd150d499d6c5e462e29dec1e1a15233

Comment 4 Jarek Prokop 2022-02-28 22:44:09 UTC
The issue is in the old bundler, namely the older syntax command of `bundle config` for entering the key-value pairs for configuration.
In short, it thought that "set" is a key and not a command as is the case with newer bundler.

This PR[0] uses the older syntax instead, which seems backward compatible with the newer bundler that comes with Ruby 2.7 and 3.0.

I have included example commands in the PR as well as the logs of s2i build for Ruby 2.6, 2.7, and 3.0.

[0] https://github.com/sclorg/rails-ex/pull/147

Comment 6 Yaakov Selkowitz 2022-03-01 17:09:18 UTC
We're getting successful image-eco runs again, so looks like that fixed it.  Thanks for your help with this!