Skip to content

Commit 4a15d5d

Browse files
authored
Bump default ruby and bundler versions (#408)
* Bump default ruby and bundler versions * Update test The purpose of this test is to validate that metadata stays valid between versions. However the Ruby version change between default version bumps was causing a cache invalidation. This test is made more robust by specifying an explicit Ruby version * Attempt to reduce non-deterministic output #409
1 parent e2e2bd8 commit 4a15d5d

File tree

3 files changed

+45
-13
lines changed

3 files changed

+45
-13
lines changed

buildpacks/ruby/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Default Ruby version is now 3.3.7 and default bundler version is now 2.5.23 ([#408](https://github.com/heroku/buildpacks-ruby/pull/408))
13+
1014
### Fixed
1115

1216
- The `docker run` command no longer requires an entrypoint when using default processes provided by `heroku/ruby` directly (and not the `heroku/procfile` buildpack) ([#404](https://github.com/heroku/buildpacks-ruby/pull/404))

buildpacks/ruby/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ impl Buildpack for RubyBuildpack {
125125
let lockfile_contents = fs_err::read_to_string(&lockfile)
126126
.map_err(|error| RubyBuildpackError::MissingGemfileLock(lockfile, error))?;
127127
let gemfile_lock = GemfileLock::from_str(&lockfile_contents).expect("Infallible");
128-
let bundler_version = gemfile_lock.resolve_bundler("2.5.6");
129-
let ruby_version = gemfile_lock.resolve_ruby("3.2.6");
128+
let bundler_version = gemfile_lock.resolve_bundler("2.5.23");
129+
let ruby_version = gemfile_lock.resolve_ruby("3.3.7");
130130

131131
// ## Install metrics agent
132132
build_output = {

buildpacks/ruby/tests/integration_test.rs

+39-11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use libcnb_test::{
1010
};
1111
use pretty_assertions::assert_eq;
1212
use regex::Regex;
13+
use std::io::Write;
1314
use std::os::unix::fs::PermissionsExt;
1415
use std::path::{Path, PathBuf};
1516
use std::thread;
@@ -24,14 +25,38 @@ fn test_migrating_metadata_or_layer_names() {
2425
// This test is a placeholder for when a change modifies metadata structures.
2526
// Remove the return and update the `buildpack-ruby` reference to the latest version.
2627
#![allow(unreachable_code)]
27-
// Test v5.0.1 compatible with v5.0.0
28+
// Test v7.0.0 compatible with v6.0.0
2829

2930
let builder = "heroku/builder:24";
30-
let app_dir = "tests/fixtures/default_ruby";
31+
let temp = tempfile::tempdir().unwrap();
32+
let app_dir = temp.path();
33+
34+
copy_dir_all(
35+
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
36+
.join("tests")
37+
.join("fixtures")
38+
.join("default_ruby"),
39+
app_dir,
40+
)
41+
.unwrap();
42+
43+
// Specify explicit versions so changes in default values don't cause this test to fail
44+
writeln!(
45+
fs_err::OpenOptions::new()
46+
.write(true)
47+
.append(true)
48+
.open(app_dir.join("Gemfile.lock"))
49+
.unwrap(),
50+
indoc! {"
51+
RUBY VERSION
52+
ruby 3.4.2
53+
"}
54+
)
55+
.unwrap();
3156

3257
TestRunner::default().build(
3358
BuildConfig::new(builder, app_dir).buildpacks([BuildpackReference::Other(
34-
"docker://docker.io/heroku/buildpack-ruby:5.0.0".to_string(),
59+
"docker://docker.io/heroku/buildpack-ruby:6.0.0".to_string(),
3560
)]),
3661
|context| {
3762
println!("{}", context.pack_stderr);
@@ -166,18 +191,21 @@ fn test_default_app_ubuntu20() {
166191
STDERR.sync = true
167192
168193
task "assets:precompile" do
169-
puts "START RAKE TEST OUTPUT"
170-
run!("echo $PATH")
171-
run!("which -a rake")
172-
run!("which -a ruby")
173-
puts "END RAKE TEST OUTPUT"
194+
out = String.new
195+
out << "START RAKE TEST OUTPUT\n"
196+
out << run!("echo $PATH")
197+
out << run!("which -a rake")
198+
out << run!("which -a ruby")
199+
out << "END RAKE TEST OUTPUT\n"
200+
puts out
174201
end
175202
176203
def run!(cmd)
177-
puts "$ #{cmd}"
178-
output = `#{cmd} 2>&1`
204+
output = String.new
205+
output << "$ #{cmd}\n"
206+
output << `#{cmd} 2>&1`
179207
raise "Command #{cmd} failed with output #{output}" unless $?.success?
180-
puts output
208+
output
181209
end
182210
"#).unwrap();
183211

0 commit comments

Comments
 (0)