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

Add Ruby 3.3 #507

Merged
merged 4 commits into from
May 16, 2024
Merged

Add Ruby 3.3 #507

merged 4 commits into from
May 16, 2024

Conversation

pvalena
Copy link
Member

@pvalena pvalena commented Nov 28, 2023

For testing, I'm using Ruby from my COPR, as it's built for c9s/c8s etc.

You can find the changes here: https://github.com/pvalena/s2i-ruby-container/tree/3.3-experimental

And I've also pushed the built images for testing: #507 (comment)

@pvalena
Copy link
Member Author

pvalena commented Jan 15, 2024

Testing c9s, c8s, rhel9 and rhel8 now.

@pvalena pvalena marked this pull request as ready for review January 17, 2024 19:28
@pvalena
Copy link
Member Author

pvalena commented Jan 17, 2024

I have managed to make rails-ex work for Ruby 3.3 as well as with all other releases.

Test logs: https://gist.github.com/pvalena/88b5e670e3d8a1bbbc44ee6521708a6f

@pvalena
Copy link
Member Author

pvalena commented Jan 17, 2024

@jackorp @phracek PTAL.

@pvalena
Copy link
Member Author

pvalena commented Jan 17, 2024

[test][test-openshift]

@pvalena
Copy link
Member Author

pvalena commented Jan 17, 2024

I've pushed images for testing:

quay.io/s2i-ruby/fedora:3.3-experimental
quay.io/s2i-ruby/c8s:3.3-experimental
quay.io/s2i-ruby/c9s:3.3-experimental

@pvalena
Copy link
Member Author

pvalena commented Jan 31, 2024

Can we merge this? Is anything else needed from my side?

@jackorp
Copy link
Contributor

jackorp commented Jan 31, 2024

Looking at commits you probably didn't follow the flow outlined in the contributing file: https://github.com/sclorg/welcome/blob/master/contribution.md#2-add-sources in that the commit history seems lost on the 3.3 directory.

@pvalena
Copy link
Member Author

pvalena commented Jan 31, 2024

You're right, sorry, I forgot about that.

@pvalena pvalena marked this pull request as draft January 31, 2024 11:09
@jackorp
Copy link
Contributor

jackorp commented Jan 31, 2024

BTW there also seem to be some more steps related to the individual tests compared to the last time I touched containers. Actually there is "enable testing" step that should happen as a PR and merged before this one...

@pvalena
Copy link
Member Author

pvalena commented Jan 31, 2024

BTW there also seem to be some more steps related to the individual tests compared to the last time I touched containers. Actually there is "enable testing" step that should happen as a PR and merged before this one...

You're right, but I thought I've enabled forgot to check... will fix

3.3/Dockerfile.fedora Outdated Show resolved Hide resolved
@pvalena pvalena marked this pull request as ready for review February 12, 2024 19:50
@pvalena
Copy link
Member Author

pvalena commented Feb 12, 2024

[test][test-openshift]

@pvalena
Copy link
Member Author

pvalena commented Feb 12, 2024

(Fixed git history, Ready for Review)

@phracek @jackorp

@phracek
Copy link
Member

phracek commented Feb 13, 2024

Tests failed here:

echo ' [PASSED] for '\''db'\'' test_docker_run_usage (00:00:00)
 [PASSED] for '\''db'\'' test_application (00:00:01)
 [FAILED] for '\''db'\'' test_connection (00:00:11)
 [PASSED] for '\''db'\'' test_scl_variables_in_dockerfile (00:00:00)
 [FAILED] for '\''db'\'' test_scl_usage (00:00:01)
 [PASSED] for '\''db'\'' test_npm_functionality (00:00:04)
 [PASSED] for '\''puma'\'' test_docker_run_usage (00:00:01)
 [PASSED] for '\''puma'\'' test_application (00:00:01)
 [PASSED] for '\''puma'\'' test_connection (00:00:00)
 [PASSED] for '\''puma'\'' test_scl_variables_in_dockerfile (00:00:00)
 [PASSED] for '\''puma'\'' test_scl_usage (00:00:01)
 [PASSED] for '\''puma'\'' test_npm_functionality (00:00:04)
 [PASSED] for '\''rack'\'' test_docker_run_usage (00:00:01)
 [PASSED] for '\''rack'\'' test_application (00:00:01)
 [PASSED] for '\''rack'\'' test_connection (00:00:01)
 [PASSED] for '\''rack'\'' test_scl_variables_in_dockerfile (00:00:00)
 [PASSED] for '\''rack'\'' test_scl_usage (00:00:01)
 [PASSED] for '\''rack'\'' test_npm_functionality (00:00:03)
 [FAILED] for '\''from_dockerfile'\'' test_from_dockerfile (00:04:14)
 [FAILED] for '\''from_dockerfile'\'' test_from_dockerfile_s2i (00:04:07)

The log from test_connection is:

-----------------------------------------------
+ test_connection
++ container_ip
+++ cat /tmp/tmp.2D2lbgSdp4/./tmp.RSX58iohdd.cid
++ docker inspect '--format={{ .NetworkSettings.IPAddress }}' 089a34a5f0baa1c946e4d4333f947dacf822883391c7d77aa79a7d2cc6f40544
+ info 'Testing the HTTP connection (http://10.88.0.8:8080)'
+ echo -e '\n\e[1m[INFO] Testing the HTTP connection (http://10.88.0.8:8080)...\e[0m\n'

�[1m[INFO] Testing the HTTP connection (http://10.88.0.8:8080)...�[0m

+ local max_attempts=10
+ local sleep_time=1
+ local attempt=1
+ local result=1
+ '[' 1 -le 10 ']'
+++ container_ip
++++ cat /tmp/tmp.2D2lbgSdp4/./tmp.RSX58iohdd.cid
+++ docker inspect '--format={{ .NetworkSettings.IPAddress }}' 089a34a5f0baa1c946e4d4333f947dacf822883391c7d77aa79a7d2cc6f40544
++ curl -s -w '%{http_code}' -o /dev/null http://10.88.0.8:8080/
+ response_code=000
+ status=7
+ '[' 7 -eq 0 ']'
+ attempt=2
+ sleep 1
Parsing options from the first comment line is deprecated!
/opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/session/cookie.rb:7: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of rack-2.2.8 to add base64 into its gemspec.
/opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/notifications/fanout.rb:3: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec. Also contact author of activesupport-6.1.7.6 to add mutex_m into its gemspec.
/opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/xml_mini.rb:5: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. Also contact author of activesupport-6.1.7.6 to add bigdecimal into its gemspec.
/usr/share/ruby/bundled_gems.rb:74:in `require': Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so: undefined symbol: rb_tainted_str_new2 - /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so (LoadError)
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/mysql2-0.5.3/lib/mysql2.rb:36:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:7:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1205:in `resolve_pool_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1046:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:52:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:64:in `database='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:58:in `database_file='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:41:in `registered'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1455:in `block in register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `each'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1947:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:2008:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:88:in `<module:Sinatra>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:12:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config/database.rb:1:in `<top (required)>'
	from /opt/app-root/src/app.rb:2:in `require_relative'
	from /opt/app-root/src/app.rb:2:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config.ru:2:in `block in <main>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:249:in `app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:422:in `wrapped_app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:312:in `block in start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:379:in `handle_profiling'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:311:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:168:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/bin/rackup:5:in `<top (required)>'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `load'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `<main>'
/usr/share/ruby/bundled_gems.rb:74:in `require': /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so: undefined symbol: rb_tainted_str_new2 - /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so (LoadError)
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/mysql2-0.5.3/lib/mysql2.rb:36:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:7:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1205:in `resolve_pool_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1046:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:52:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:64:in `database='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:58:in `database_file='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:41:in `registered'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1455:in `block in register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `each'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1947:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:2008:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:88:in `<module:Sinatra>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:12:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config/database.rb:1:in `<top (required)>'
	from /opt/app-root/src/app.rb:2:in `require_relative'
	from /opt/app-root/src/app.rb:2:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config.ru:2:in `block in <main>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:249:in `app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:422:in `wrapped_app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:312:in `block in start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:379:in `handle_profiling'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:311:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:168:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/bin/rackup:5:in `<top (required)>'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `load'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `<main>'
+ '[' 2 -le 10 ']'

@jackorp
Copy link
Contributor

jackorp commented Feb 13, 2024

If I am reading the logs correctly the mysql2 failure is a bit problematic, AFAICT the problem is coming from this repo: https://github.com/openshift/ruby-hello-world which is using the mysql2 gem. We should be, in theory, able to just upgrade that gem.

skimmed the logs, also saw some postgresql failures:

pg_result.c: In function 'init_pg_result':
pg_result.c:1590:65: error: 'rb_cData' undeclared (first use in this function)
1590 |         rb_cPGresult = rb_define_class_under( rb_mPG, "Result", rb_cData
);
      |                                                                 ^~~~~~~~
pg_result.c:1590:65: note: each undeclared identifier is reported only once for
each function it appears in
make: *** [Makefile:249: pg_result.o] Error 1

make failed, exit code 2

Gem files will remain installed in
/opt/app-root/src/bundle/ruby/3.3.0/gems/pg-1.2.3 for inspection.
Results logged to
/opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/pg-1.2.3/gem_make.out

  /usr/share/rubygems/rubygems/ext/builder.rb:125:in `run'
  /usr/share/rubygems/rubygems/ext/builder.rb:51:in `block in make'
  /usr/share/rubygems/rubygems/ext/builder.rb:43:in `each'
  /usr/share/rubygems/rubygems/ext/builder.rb:43:in `make'
  /usr/share/rubygems/rubygems/ext/ext_conf_builder.rb:42:in `build'
  /usr/share/rubygems/rubygems/ext/builder.rb:193:in `build_extension'
  /usr/share/rubygems/rubygems/ext/builder.rb:227:in `block in build_extensions'
  /usr/share/rubygems/rubygems/ext/builder.rb:224:in `each'
  /usr/share/rubygems/rubygems/ext/builder.rb:224:in `build_extensions'
  /usr/share/rubygems/rubygems/installer.rb:852:in `build_extensions'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/rubygems_gem_installer.rb:76:in
`build_extensions'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/source/rubygems.rb:205:in
`install'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/installer/parallel_installer.rb:132:in
`do_install'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/installer/parallel_installer.rb:123:in
`block in worker_pool'
  /usr/share/gems/gems/bundler-2.5.3/lib/bundler/worker.rb:62:in `apply_func'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/worker.rb:57:in `block in
process_queue'
  <internal:kernel>:187:in `loop'
  /usr/share/gems/gems/bundler-2.5.3/lib/bundler/worker.rb:54:in `process_queue'
/usr/share/gems/gems/bundler-2.5.3/lib/bundler/worker.rb:90:in `block (2
levels) in create_threads'

An error occurred while installing pg (1.2.3), and Bundler cannot continue.

In Gemfile:
  pg

Both, the mysql2 and PG DB connectors install failure are related to C API methods having been removed from Ruby. They are used by these older gems and Ruby 3.3. As we want to still test RHEL 7, now comes the point to branch out the rails-ex used in tests to install this there is sclorg/rails-ex#169 made to address the PG failure. I am crossing my fingers that mysql2 update will just work.

@jackorp
Copy link
Contributor

jackorp commented Feb 13, 2024

Made a PR for the mysql2 failure: openshift/ruby-hello-world#146

@jackorp
Copy link
Contributor

jackorp commented Feb 13, 2024

#518 Made PR to use the new rails-ex branch

@pvalena
Copy link
Member Author

pvalena commented Feb 14, 2024

[test][test-openshift]

@jackorp
Copy link
Contributor

jackorp commented Feb 26, 2024

Non-openshift tests: permission failure; failure to write to Gemfile.lock (Dockerfile test; in a built container) - Jarek is looking into those

Biggest suspect is currently newer bundler v2.5.3 distributed with Ruby 3.3 that is trying to rewrite Gemfile.lock for some reason. Of course that will fail since everything in the directory is owned by root.

If I use ubi9/ruby-31 container (which has bundler v2.3.7) it passes OK. However, update bundler to exactly v2.5.3 via

$ gem install --bindir=/opt/app-root/src/other_bin bundler --version 2.5.3
$ export PATH="$PATH:/opt/app-root/src/other_bin"

(specifying bindir and appending PATH is required since there is already one bindir on ~/bin from rails app itself owned by root therefore unwriteable for us.)

Change happened between bundler 2.4.22 and 2.5.0.

This might not be an easy or even desired fix for Ruby...

2.5 openshift tests:
It has some problems with not initially finding rake correctly, but installing it later. While it is very fishy, it may not be the problem itself.

The bigger problem is the following, probably something with the rails-ex app assemble script. I'll inspect the script used to see what's the problem.

---> Starting asset compilation ...
rake aborted!
ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `bin/rails credentials:edit`
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:603:in `validate_secret_key_base'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:437:in `secret_key_base'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:177:in `key_generator'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:201:in `message_verifier'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activestorage-6.1.7.6/lib/active_storage/engine.rb:127:in `block (2 levels) in <class:Engine>'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:68:in `block in execute_hook'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:51:in `each'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application/finisher.rb:140:in `block in <module:Finisher>'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:32:in `instance_exec'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:32:in `run'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:61:in `block in run_initializers'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:60:in `run_initializers'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:391:in `initialize!'
/opt/app-root/src/config/environment.rb:5:in `<top (required)>'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
/opt/app-root/src/bundle/ruby/2.5.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:367:in `require_environment!'
/opt/app-root/src/bundle/ruby/2.5.0/gems/railties-6.1.7.6/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/opt/app-root/src/bundle/ruby/2.5.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
/opt/app-root/src/bundle/ruby/2.5.0/gems/rake-13.1.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => environment

@jackorp
Copy link
Contributor

jackorp commented Feb 26, 2024

The test_from_dockerfile on Ruby 3.3 is broken because of: rubygems/rubygems#7220 , it now basically does touch Gemfile.lock even if there are no changes, unless there is a flag. And touch <file> where <file> is not owned by the user touching it will raise a permission error.

So with that in mind, when we ADD, it is copied and the files are owned by root:root

bundle install --path ./bundle --frozen fixes it.
Or more properly:

$ bundle config set frozen true

Or IMHO even better, one of following fixes it better because I'd say the Dockerfile is incorrect:

1. ADD with chown

diff --git a/examples/from-dockerfile/Dockerfile b/examples/from-dockerfile/Dockerfile
index 3ef8baa..b4d3db9 100644
--- a/examples/from-dockerfile/Dockerfile
+++ b/examples/from-dockerfile/Dockerfile
@@ -1,6 +1,6 @@
 FROM ubi8/ruby-27

-ADD app-src ./
+ADD --chown=default:root app-src ./

 RUN bundle install --path ./bundle

2. chown the dir

diff --git a/examples/from-dockerfile/Dockerfile b/examples/from-dockerfile/Dockerfile
index 3ef8baa..4eeebf2 100644
--- a/examples/from-dockerfile/Dockerfile
+++ b/examples/from-dockerfile/Dockerfile
@@ -1,6 +1,9 @@
 FROM ubi8/ruby-27
 
+USER 0
 ADD app-src ./
+RUN chown -R default:root ./
+USER default
 
 RUN bundle install --path ./bundle
 

3. Just be root

diff --git a/examples/from-dockerfile/Dockerfile b/examples/from-dockerfile/Dockerfile
index 3ef8baa..01f61bf 100644
--- a/examples/from-dockerfile/Dockerfile
+++ b/examples/from-dockerfile/Dockerfile
@@ -1,5 +1,6 @@
 FROM ubi8/ruby-27
 
+USER 0
 ADD app-src ./
 
 RUN bundle install --path ./bundle

All 3 approaches were tested locally, it no longer fails with any of them.

... What is the test testing anyway? (noticed it in READMEs) Why are we testing user install in a mostly root folder?

@jackorp
Copy link
Contributor

jackorp commented Feb 27, 2024

The 2.5 might be failing because it is taking 3.3 rails-ex branch that had updated the assemble file. I messed up the condition...

(3 step/commit workflow to preserve history)
(3 step/commit workflow to preserve history)
(3 step/commit workflow to preserve history)
@zmiklank
Copy link
Contributor

[test-all]

@jackorp
Copy link
Contributor

jackorp commented Mar 4, 2024

Ruby 3.0 Docker test failed because RHEL 7 does not have new enough docker that has --chown option for the ADD instruction... In the end some approach utilizing shell will be better after all.

ENV NAME=ruby \
RUBY_VERSION=3.3 \
RUBY_SHORT_VER=33 \
VERSION=0
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please set the VERSION to empty string?
To fix this issue:
#530

@phracek
Copy link
Member

phracek commented May 9, 2024

[test]

@phracek
Copy link
Member

phracek commented May 13, 2024

RHEL8 and RHEL9 3.3 versions failed for this reason:

-----------------------------------------------
+ echo 'Running test test_scl_usage (starting at 2024-05-13 03:34:54-04:00) ... '
Running test test_scl_usage (starting at 2024-05-13 03:34:54-04:00) ... 
+ echo -----------------------------------------------
-----------------------------------------------
+ test_scl_usage
+ scl_usage 'ruby --version' 'ruby .'
+ local 'run_cmd=ruby --version'
+ local 'expected=ruby .'
+ info 'Testing the image SCL enable'
+ echo -e '\n\e[1m[INFO] Testing the image SCL enable...\e[0m\n'

[INFO] Testing the image SCL enable...

++ docker run --rm ubi9/ruby-33:1 /bin/bash -c 'ruby --version'
+ out='ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]'
+ echo 'ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]'
+ grep -q 'ruby .'
+++ cat /tmp/tmp.bJJ5L8Dn4E/./tmp.cUDYCe5waK.cid
cat: /tmp/tmp.bJJ5L8Dn4E/./tmp.cUDYCe5waK.cid: No such file or directory
++ docker exec /bin/bash -c 'ruby --version'
+ out='Error: no container with name or ID "bin/bash" found: no such container'
+ grep -q 'ruby .'
+ echo 'Error: no container with name or ID "bin/bash" found: no such container'
+ echo 'ERROR[exec /bin/bash -c ruby' '--version] Expected '\''ruby .'\'', got '\''Error: no container with name or ID "bin/bash" found: no such container'\'''
ERROR[exec /bin/bash -c ruby --version] Expected 'ruby .', got 'Error: no container with name or ID "bin/bash" found: no such container'
+ return 1
+ ct_check_testcase_result 1

@jackorp PTAL

@jackorp
Copy link
Contributor

jackorp commented May 13, 2024

if I am reading it correctly, there is no running container, so tests expecting it fail. The problem is visible more up, when testing the actual app:

[INFO] Testing the HTTP connection (http://10.88.0.8:8080)...

+ local max_attempts=10
+ local sleep_time=1
+ local attempt=1
+ local result=1
+ '[' 1 -le 10 ']'
+++ container_ip
++++ cat /tmp/tmp.hwmCZID7cY/./tmp.Cwvr4F4tap.cid
+++ docker inspect '--format={{ .NetworkSettings.IPAddress }}' 0ce23eaea75f96dcf1403a9338a94a900ff79e54cf8289766d2eab5d43c7f637
++ curl -s -w '%{http_code}' -o /dev/null http://10.88.0.8:8080/
+ response_code=000
+ status=7
+ '[' 7 -eq 0 ']'
+ attempt=2
+ sleep 1
Parsing options from the first comment line is deprecated!
/opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/session/cookie.rb:7: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of rack-2.2.8 to add base64 into its gemspec.
/opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/notifications/fanout.rb:3: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec. Also contact author of activesupport-6.1.7.6 to add mutex_m into its gemspec.
/opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/xml_mini.rb:5: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. Also contact author of activesupport-6.1.7.6 to add bigdecimal into its gemspec.
/usr/share/ruby/bundled_gems.rb:74:in `require': Error loading the 'mysql2' Active Record adapter. Missing a gem it depends on? /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so: undefined symbol: rb_tainted_str_new2 - /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so (LoadError)
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/mysql2-0.5.3/lib/mysql2.rb:36:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:7:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1205:in `resolve_pool_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1046:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:52:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:64:in `database='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:58:in `database_file='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:41:in `registered'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1455:in `block in register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `each'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1947:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:2008:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:88:in `<module:Sinatra>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:12:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config/database.rb:1:in `<top (required)>'
	from /opt/app-root/src/app.rb:2:in `require_relative'
	from /opt/app-root/src/app.rb:2:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config.ru:2:in `block in <main>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:249:in `app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:422:in `wrapped_app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:312:in `block in start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:379:in `handle_profiling'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:311:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:168:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/bin/rackup:5:in `<top (required)>'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `load'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `<main>'
/usr/share/ruby/bundled_gems.rb:74:in `require': /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so: undefined symbol: rb_tainted_str_new2 - /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so (LoadError)
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/mysql2-0.5.3/lib/mysql2.rb:36:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/mysql2_adapter.rb:7:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1205:in `resolve_pool_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:1046:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/activerecord-6.1.7.6/lib/active_record/connection_handling.rb:52:in `establish_connection'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:64:in `database='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:58:in `database_file='
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1273:in `set'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:41:in `registered'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1455:in `block in register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `each'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1453:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1947:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:2008:in `register'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:88:in `<module:Sinatra>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/sinatra-activerecord-2.0.22/lib/sinatra/activerecord.rb:12:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config/database.rb:1:in `<top (required)>'
	from /opt/app-root/src/app.rb:2:in `require_relative'
	from /opt/app-root/src/app.rb:2:in `<top (required)>'
	from /usr/share/ruby/bundled_gems.rb:74:in `require'
	from /usr/share/ruby/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /opt/app-root/src/config.ru:2:in `block in <main>'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:249:in `app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:422:in `wrapped_app'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:312:in `block in start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:379:in `handle_profiling'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:311:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/lib/rack/server.rb:168:in `start'
	from /opt/app-root/src/bundle/ruby/3.3.0/gems/rack-2.2.8/bin/rackup:5:in `<top (required)>'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `load'
	from /opt/app-root/src/bundle/ruby/3.3.0/bin/rackup:25:in `<main>'

I think the curl triggers chain of library loading until we get to the gem's extension and fail because the mysql2 solib expected to find a symbol in Ruby that was removed. This then probably prompts the app to crash (logs seem to point to it but I am only 95% confident without seeing the STATUS field from the podman ps -a for that container) which kills the container and the container ID and the CID file then point to invalid or no container.

The following is the culprit:

/usr/share/ruby/bundled_gems.rb:74:in `require': /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so: undefined symbol: rb_tainted_str_new2 - /opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so (LoadError)

The API was removed in Ruby 3.3, so loading the binary extension of the gem that is expecting it will fail.

The source seems to be from git repo:

+ pushd /root/sclorg/s2i-ruby-container/3.3/test
~/sclorg/s2i-ruby-container/3.3/test ~/sclorg/s2i-ruby-container/3.3
+ '[' -d db-test-app ']'
+ git clone https://github.com/openshift/ruby-hello-world.git db-test-app
Cloning into 'db-test-app'...
+ popd

And from logs we can see path:

/opt/app-root/src/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/mysql2-0.5.3/mysql2/mysql2.so

The mysql2-0.5.3 tips me off (it is simply ${gem_name}-${gem_version}) that we are still running the un-updated gem somewhere in the dependencies for the tests, which in this case is the the openshift ruby-hello-world.

for which there is already a PR that bumps the gem version that no longer fails due to the removed APIs: openshift/ruby-hello-world#146

So in this case we are depending on that PR's content to unblock that part of CI as well.

@phracek
Copy link
Member

phracek commented May 14, 2024

OpenShift part was merged. Let's try one more round

[test]

@@ -118,7 +118,7 @@ scl_usage() {
}

function test_scl_usage() {
scl_usage "ruby --version" "ruby ${RUBY_VERSION}."
scl_usage "ruby --version" "ruby ${VERSION}."
Copy link
Contributor

Choose a reason for hiding this comment

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

$VERSION should be se to empty string. Not sure this test does what it should have.

Copy link
Member

Choose a reason for hiding this comment

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

The test tests if ruby version is the same as tests. Like we do in the rest containers.
Nevertless, RUBY_VERSION is specified in container and not in host system where the test is running.

As examples see:
https://github.com/sclorg/s2i-php-container/blob/master/test/run#L186
https://github.com/sclorg/s2i-nodejs-container/blob/master/test/test-lib-nodejs.sh#L250

@jackorp
Copy link
Contributor

jackorp commented May 14, 2024

Yay, new error (I didn't meet it before with the app...)

++ curl -s -w '%{http_code}' -o /dev/null http://10.88.0.8:8080/
2024-05-14 06:32:19 - Errno::ENOENT - No such file or directory @ rb_sysopen - /usr/share/ruby/views/main.erb:

Though this one seems strange. It is looking for views in /usr/share/ruby ??

@jackorp
Copy link
Contributor

jackorp commented May 14, 2024

The file that is under settings.app_file in sinatra is /usr/share/ruby/bundled_gems.rb. That is an important setting since it calculates file path for not only views, the settings.root, so it searches for stuff in /usr/share/ruby/ instead of where we want it to..

Sinatra upstream fixed it in: sinatra/sinatra#1973

Ruby 3.3 caused it most probably in: ruby/ruby@214f6d6

There is some smartistic with regards to where the app.rb is located in sinatra code.
Fix arrived in sinatra 3.2.0, but that version requires ruby >= 2.6.0, this would require another branching of app version and the code...

Here we have an actual alternative. We can add something akin to set :app_file, __FILE__ to the app.rb file. Since rest of default paths seem to be calculated from that.

@pvalena
Copy link
Member Author

pvalena commented May 14, 2024

The file that is under settings.app_file in sinatra is /usr/share/ruby/bundled_gems.rb. That is an important setting since it calculates file path for not only views, the settings.root, so it searches for stuff in /usr/share/ruby/ instead of where we want it to..

Sinatra upstream fixed it in: sinatra/sinatra#1973

Ruby 3.3 caused it most probably in: ruby/ruby@214f6d6

There is some smartistic with regards to where the app.rb is located in sinatra code. Fix arrived in sinatra 3.2.0, but that version requires ruby >= 2.6.0, this would require another branching of app version and the code...

Ah :( But it's inevitable in the end I guess....

Here we have an actual alternative. We can add something akin to set :app_file, __FILE__ to the app.rb file. Since rest of default paths seem to be calculated from that.

That fix would be in the example app, right? Do you think it's a stable solution? Can you please look into that?

@jackorp
Copy link
Contributor

jackorp commented May 14, 2024

That fix would be in the example app, right?

Yes, we could even inject the line ourselves for Ruby 2.5 if the need arises.

Do you think it's a stable solution? Can you please look into that?

It should work OK even for longer time. (Edit note: currently tested versions of sinatra 3.2.0 and 4.0.0. Completely OK and working with the option). I'll test it with newer versions, see how it behaves, but in any case, I can and will work to port it to the hello-world openshift app.

@jackorp
Copy link
Contributor

jackorp commented May 14, 2024

@phracek / @zmiklank The PR fixing the issue via setting the option openshift/ruby-hello-world#147 was merged, please re-test

@zmiklank
Copy link
Contributor

[test-all]

@jackorp
Copy link
Contributor

jackorp commented May 15, 2024

Testing Farm - RHEL9 - 3.3 and Testing Farm - RHEL8 - 3.3 is green 🥳

@phracek
Copy link
Member

phracek commented May 16, 2024

OpenShift 4 tests will be solved by another PR. Let's get merge it.

COOOOL HARD WORK. THANK YOU GUYS @pvalena @jackorp

@phracek phracek merged commit d967590 into sclorg:master May 16, 2024
8 of 18 checks passed
@zmiklank
Copy link
Contributor

@phracek @jackorp We have an unresolved issue here - regarding the VERSION not being set to empty string in Fedora Dockerfile. Could you please file a PR with a fix?

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