Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since Ruby 3.3 [0], bundled_gems.rb intercepts
require
calls with bundler. Under sinatra, this causes issues. Sinatra searches for theapp.rb
style files in the call stack. Once found, sinatra uses that file as a project's root. From there it searches for other default directories suchviews
and other.Example of such failure from logs:
This error appears only once a request was made to the part of code that relies on the relative default paths, such as the './views' for the erb templates.
This was fixed with Sinatra 3.2.0[1], but to keep compatibility with Ruby 2.5, Sinatra version 2.* should remain for a while as Sinatra 3.* restricts minimum Ruby version to Ruby 2.6.
We work around it ourselves by overriding the :app_file setting in
app.rb
file to__FILE__
which will fix the rest of paths.[0] ruby/ruby@214f6d6
[1] https://github.com/sinatra/sinatra/blob/main/CHANGELOG.md#320--2023-12-29
Problem found in tests for s2i ruby container: sclorg/s2i-ruby-container#507 (comment) .
This commit was tested with Ruby 2.5, 3.0, 3.1 and 3.3. Simple GET request that was failing as outlined above is now passing:
For 2.5 to 3.1 the
registry.access.redhat.com/ubi8/ruby-$VERSION
container namespace was used. For 3.3, customquay.io/s2i-ruby/c9s:3.3-experimental
was used. Functionality is the same. Container was run as:podman run -p8080:8080 -it --rm localhost/test-hello:latest /usr/libexec/s2i/run
, Dockerfile was slightly adjusted to keep more in-sync with what we were seeing in our tests.Relevant excerpts from logs:
2.5:
3.0:
3.1:
3.3: