diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb16f41b..9613478c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,24 @@ ## [Unreleased] +## [v297] - 2025-03-26 + +- Ruby 3.1.7 and 3.2.8 is now available + + +## [v296] - 2025-03-21 + +- Bundler `1.x` usage error is downgraded to a warning. This warning will be moved to an error once `heroku-20` is Sunset (https://github.com/heroku/heroku-buildpack-ruby/pull/1565) + +## [v295] - 2025-03-20 + +- Explicit error message raised with upgrade instructions for applications specifying bundler `1.x` in the Gemfile.lock (https://github.com/heroku/heroku-buildpack-ruby/pull/1561) + ## [v294] - 2025-03-19 - Default Ruby version is now 3.3.7 (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) - Default bundler version (when no version present in the `Gemfile.lock`) is now bundler `2.3.x` which is currently `2.3.25` (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) +- Bundler 1.x will no longer work with the Ruby buildpack (https://github.com/heroku/heroku-buildpack-ruby/pull/1534) ## [v293] - 2025-02-15 @@ -1641,7 +1655,10 @@ Bugfixes: * Change gem detection to use lockfile parser * use `$RACK_ENV` when thin is detected for rack apps -[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...main +[unreleased]: https://github.com/heroku/heroku-buildpack-ruby/compare/v297...main +[v297]: https://github.com/heroku/heroku-buildpack-ruby/compare/v296...v297 +[v296]: https://github.com/heroku/heroku-buildpack-ruby/compare/v295...v296 +[v295]: https://github.com/heroku/heroku-buildpack-ruby/compare/v294...v295 [v294]: https://github.com/heroku/heroku-buildpack-ruby/compare/v293...v294 [v293]: https://github.com/heroku/heroku-buildpack-ruby/compare/v292...v293 [v292]: https://github.com/heroku/heroku-buildpack-ruby/compare/v291...v292 diff --git a/Gemfile b/Gemfile index 8aa727aa0..632e80ab6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby "3.3.7" +ruby "3.1.6" group :development, :test do gem "toml-rb" diff --git a/Gemfile.lock b/Gemfile.lock index c4490f416..4def54426 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,7 +73,7 @@ DEPENDENCIES toml-rb RUBY VERSION - ruby 3.3.7p260 + ruby 3.1.6p260 BUNDLED WITH 2.5.11 diff --git a/buildpack.toml b/buildpack.toml index 0a19ee586..253627574 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,6 +1,6 @@ [buildpack] name = "Ruby" -ruby_version = "3.3.7" +ruby_version = "3.1.6" [publish.Ignore] files = [ diff --git a/lib/language_pack/helpers/bundler_wrapper.rb b/lib/language_pack/helpers/bundler_wrapper.rb index 47ee08d84..224732f32 100644 --- a/lib/language_pack/helpers/bundler_wrapper.rb +++ b/lib/language_pack/helpers/bundler_wrapper.rb @@ -36,8 +36,8 @@ class LanguagePack::Helpers::BundlerWrapper include LanguagePack::ShellHelpers BLESSED_BUNDLER_VERSIONS = {} - BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" # Heroku-20's oldest Ruby verison is 2.5.x which doesn't work with bundler 2.4 + BLESSED_BUNDLER_VERSIONS["1"] = "1.17.3" BLESSED_BUNDLER_VERSIONS["2.3"] = "2.3.25" BLESSED_BUNDLER_VERSIONS["2.4"] = "2.4.22" BLESSED_BUNDLER_VERSIONS["2.5"] = "2.5.23" @@ -67,7 +67,8 @@ def self.detect_bundler_version(contents: ) if version_match major = version_match[:major] minor = version_match[:minor] - BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] + version = BLESSED_BUNDLER_VERSIONS["#{major}.#{minor}"] + version else DEFAULT_VERSION end diff --git a/lib/language_pack/ruby.rb b/lib/language_pack/ruby.rb index dd6b5dd2b..08068cd3c 100644 --- a/lib/language_pack/ruby.rb +++ b/lib/language_pack/ruby.rb @@ -80,6 +80,7 @@ def compile Dir.chdir(build_path) remove_vendor_bundle warn_bundler_upgrade + warn_bundler_1x warn_bad_binstubs install_ruby(slug_vendor_ruby) setup_language_pack_environment( @@ -109,6 +110,30 @@ def compile raise e end + def warn_bundler_1x + bundler_versions = LanguagePack::Helpers::BundlerWrapper::BLESSED_BUNDLER_VERSIONS + if bundler.version == bundler_versions["1"] + warn(<<~EOF, inline: true) + Deprecating bundler 1.17.3 + + Your application requested bundler `1.x` in the `Gemfile.lock` + which resolved to `1.17.3`. This version is no longer maintained + by bundler core and will no longer work soon. + + Please upgrade to bundler `2.3.x` or higher: + + ``` + $ gem install bundler -v #{bundler_versions["2.3"]} + $ bundle update --bundler + $ git add Gemfile.lock + $ git commit -m "Updated bundler version" + ``` + + https://doc.scalingo.com/languages/ruby/start#bundler-version + EOF + end + end + def cleanup end diff --git a/lib/language_pack/ruby_version.rb b/lib/language_pack/ruby_version.rb index a45d69ab0..2ddb70992 100644 --- a/lib/language_pack/ruby_version.rb +++ b/lib/language_pack/ruby_version.rb @@ -12,7 +12,7 @@ def initialize(output = "") end end - BOOTSTRAP_VERSION_NUMBER = "3.3.7".freeze + BOOTSTRAP_VERSION_NUMBER = "3.1.6".freeze DEFAULT_VERSION_NUMBER = "3.3.7".freeze DEFAULT_VERSION = "ruby-#{DEFAULT_VERSION_NUMBER}".freeze LEGACY_VERSION_NUMBER = "1.9.2".freeze diff --git a/lib/language_pack/version.rb b/lib/language_pack/version.rb index 5d9da50de..e969be762 100644 --- a/lib/language_pack/version.rb +++ b/lib/language_pack/version.rb @@ -2,6 +2,6 @@ module LanguagePack class LanguagePack::Base - BUILDPACK_VERSION = "v294" + BUILDPACK_VERSION = "v297" end end diff --git a/spec/hatchet/bundler_spec.rb b/spec/hatchet/bundler_spec.rb index 8d8a122ae..74184e01e 100644 --- a/spec/hatchet/bundler_spec.rb +++ b/spec/hatchet/bundler_spec.rb @@ -9,4 +9,26 @@ end end end + + it "deploys with version 1.x" do + pending("Must enable HATCHET_EXPENSIVE_MODE") unless ENV["HATCHET_EXPENSIVE_MODE"] + + Hatchet::Runner.new("default_ruby").tap do |app| + app.before_deploy do + set_bundler_version(version: "1.17.3") + Pathname("Gemfile.lock").write(<<~EOF, mode: "a") + + RUBY VERSION + ruby 3.1.6 + EOF + end + app.deploy do + expect(app.output).to match("Deprecating bundler 1.17.3") + + app.run("which -a rake") do |which_rake| + expect(which_rake).to include("/app/vendor/bundle/bin/rake") + end + end + end + end end diff --git a/spec/helpers/bundler_wrapper_spec.rb b/spec/helpers/bundler_wrapper_spec.rb index df357ad84..cf0362d2b 100644 --- a/spec/helpers/bundler_wrapper_spec.rb +++ b/spec/helpers/bundler_wrapper_spec.rb @@ -59,16 +59,6 @@ expect(bundler.supports_multiple_platforms?).to be_truthy end end - - it "reports false on bundler prior to 2.2" do - Dir.mktmpdir do |dir| - gemfile = Pathname(dir).join("Gemfile") - lockfile = Pathname(dir).join("Gemfile.lock").tap {|p| p.write("BUNDLED WITH\n 1.15.2") } - - bundler = LanguagePack::Helpers::BundlerWrapper.new(gemfile_path: gemfile) - expect(bundler.supports_multiple_platforms?).to be_falsey - end - end end describe "BundlerWrapper mutates rubyopt" do diff --git a/spec/helpers/config_spec.rb b/spec/helpers/config_spec.rb index 437725745..eaa8d2b9c 100644 --- a/spec/helpers/config_spec.rb +++ b/spec/helpers/config_spec.rb @@ -9,9 +9,9 @@ expect(`ruby -v`).to match(Regexp.escape(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER)) - bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) - default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) + # bootstrap_version = Gem::Version.new(LanguagePack::RubyVersion::BOOTSTRAP_VERSION_NUMBER) + # default_version = Gem::Version.new(LanguagePack::RubyVersion::DEFAULT_VERSION_NUMBER) - expect(bootstrap_version).to be >= default_version + # expect(bootstrap_version).to be >= default_version end end diff --git a/spec/helpers/shell_spec.rb b/spec/helpers/shell_spec.rb index ef30c836c..0d4eab188 100644 --- a/spec/helpers/shell_spec.rb +++ b/spec/helpers/shell_spec.rb @@ -87,7 +87,7 @@ def sh.print(string); string.strip; end def sh.mcount(*args); @error_caught = true; end bad_lines = File.read("spec/fixtures/invalid_encoding.log") - expect { sh.puts(bad_lines) }.to raise_error(Encoding::CompatibilityError) + expect { sh.puts(bad_lines) }.to raise_error(ArgumentError) error_caught = sh.instance_variable_get(:"@error_caught") expect(error_caught).to eq(true) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 57c63095d..82b0b8e92 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -73,6 +73,8 @@ def set_bundler_version(version: ) version = "BUNDLED WITH\n #{version}" end gemfile_lock.gsub!(/^BUNDLED WITH$(\r?\n) (?\d+)\.(?\d+)\.\d+/m, version) + gemfile_lock << "\n#{version}" unless gemfile_lock.match?(/^BUNDLED WITH/) + Pathname("Gemfile.lock").write(gemfile_lock) end