Skip to content

Commit

Permalink
Update default bundler and ruby versions (#374)
Browse files Browse the repository at this point in the history
* Update default bundler and ruby versions

Rails 8.0.1 needs Ruby 3.2+ and unfortunately they decided to stop shipping with a Ruby version in the Gemfile. I don't yet have `.ruby-version` support, but this will at least allow a `rails new` app to work on Heroku with the default versions.

* Disable metadata migration test

We're no longer modifying metadata, we can safely disable this test (which now fails because the defaults are changing between the versions).

* Update jruby version for integration test

Older versions of JRuby do not play well with newer versions of bundler:

```
  - Running `BUNDLE_BIN="/layers/heroku_ruby/gems/bin" BUNDLE_CLEAN="1" BUNDLE_DEPLOYMENT="1" BUNDLE_GEMFILE="/workspace/Gemfile" BUNDLE_PATH="/layers/heroku_ruby/gems" BUNDLE_WITHOUT="development:test" bundle install`

      Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
      NoMethodError: undefined method `request' for nil:NilClass
      Did you mean?  require
        conflicting_dependencies at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems/resolver/conflict.rb:47
        conflicting_dependencies at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems/exceptions.rb:32
                      initialize at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems/exceptions.rb:26
                             new at org/jruby/RubyClass.java:909
                       exception at org/jruby/RubyException.java:129
                         resolve at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems/resolver.rb:193
                         resolve at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems/request_set.rb:411
                 resolve_current at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems/request_set.rb:423
                  finish_resolve at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems.rb:240
               activate_bin_path at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems.rb:300
                     synchronize at org/jruby/ext/thread/Mutex.java:171
               activate_bin_path at /layers/heroku_ruby/ruby/lib/ruby/stdlib/rubygems.rb:298
                          <main> at /layers/heroku_ruby/bundler/bin/bundle:23
```
  • Loading branch information
schneems authored Dec 16, 2024
1 parent 96715dc commit 5e40aed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions buildpacks/ruby/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Default Ruby version is now 3.2.6 ([#374](https://github.com/heroku/buildpacks-ruby/pull/374))
- Default Bundler version is now 2.5.6 ([#374](https://github.com/heroku/buildpacks-ruby/pull/374))

## [4.0.2] - 2024-12-16

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions buildpacks/ruby/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ impl Buildpack for RubyBuildpack {
let lockfile_contents = fs_err::read_to_string(&lockfile)
.map_err(|error| RubyBuildpackError::MissingGemfileLock(lockfile, error))?;
let gemfile_lock = GemfileLock::from_str(&lockfile_contents).expect("Infallible");
let bundler_version = gemfile_lock.resolve_bundler("2.4.5");
let ruby_version = gemfile_lock.resolve_ruby("3.1.3");
let bundler_version = gemfile_lock.resolve_bundler("2.5.6");
let ruby_version = gemfile_lock.resolve_ruby("3.2.6");

// ## Install metrics agent
build_output = {
Expand Down
8 changes: 4 additions & 4 deletions buildpacks/ruby/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn test_migrating_metadata() {
// Remove the return and update the `buildpack-ruby` reference to the latest version.
#![allow(unreachable_code)]
// Test v4.0.2 compatible with v4.0.1
// return;
return;

let builder = "heroku/builder:24";
let app_dir = "tests/fixtures/default_ruby";
Expand Down Expand Up @@ -148,7 +148,7 @@ fn test_jruby_app() {
r#"
source "https://rubygems.org"
ruby '2.6.8', engine: 'jruby', engine_version: '9.3.6.0'
ruby '3.1.4', engine: 'jruby', engine_version: '9.4.8.0'
"#,
)
.unwrap();
Expand All @@ -162,7 +162,7 @@ GEM
PLATFORMS
java
RUBY VERSION
ruby 2.6.8p001 (jruby 9.3.6.0)
ruby 3.1.4p001 (jruby 9.4.8.0)
DEPENDENCIES
",
)
Expand All @@ -183,7 +183,7 @@ DEPENDENCIES
context.pack_stdout,
r#"`BUNDLE_BIN="/layers/heroku_ruby/gems/bin" BUNDLE_CLEAN="1" BUNDLE_DEPLOYMENT="1" BUNDLE_GEMFILE="/workspace/Gemfile" BUNDLE_PATH="/layers/heroku_ruby/gems" BUNDLE_WITHOUT="development:test" bundle install`"#
);
assert_contains!(context.pack_stdout, "Ruby version `2.6.8-jruby-9.3.6.0` from `Gemfile.lock`");
assert_contains!(context.pack_stdout, "Ruby version `3.1.4-jruby-9.4.8.0` from `Gemfile.lock`");
});
}

Expand Down

0 comments on commit 5e40aed

Please sign in to comment.