diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e96197a..31d06bb18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Master (unreleased) +* Fix issue where the wrong version of bundler is used on CI apps (https://github.com/heroku/heroku-buildpack-ruby/pull/961) * Remove libpq external dependency (https://github.com/heroku/heroku-buildpack-ruby/pull/959) ## v210 (3/6/2020) diff --git a/bin/support/ruby_test b/bin/support/ruby_test index b138cf319..977e9b8e1 100755 --- a/bin/support/ruby_test +++ b/bin/support/ruby_test @@ -30,19 +30,20 @@ def execute_command(command) end # $ bin/test BUILD_DIR ENV_DIR ARTIFACT_DIR -build_dir, env_dir, artifact_dir = ARGV +build_dir, env_dir, _ = ARGV LanguagePack::ShellHelpers.initialize_env(env_dir) +bundler = LanguagePack::Helpers::BundlerWrapper.new( + gemfile_path: "#{build_dir}/Gemfile" +) + # The `ruby_test-compile` program installs a version of Ruby for the # user's application. It needs the propper `PATH`, where ever Ruby is installed # we always add a symlink to the `bin/ruby` file so that is always valid. # We calculate the gem path the same way we do when compiling. -LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{ENV["PATH"]}" +LanguagePack::ShellHelpers.user_env_hash["PATH"] = "#{build_dir}/bin:#{bundler.bundler_path}/bin:#{ENV["PATH"]}" LanguagePack::ShellHelpers.user_env_hash["GEM_PATH"] = LanguagePack::Ruby.slug_vendor_base -bundler = LanguagePack::Helpers::BundlerWrapper.new( - gemfile_path: "#{build_dir}/Gemfile" -) # load bundler bundler.install diff --git a/hatchet.json b/hatchet.json index 4793bb11d..c9ed6dab2 100644 --- a/hatchet.json +++ b/hatchet.json @@ -99,6 +99,7 @@ "sharpstone/rails_31_ruby_schema_format", "sharpstone/rails_31_sql_schema_format", "sharpstone/ruby_no_rails_test", - "sharpstone/activerecord_rake_tasks_does_not_exist" + "sharpstone/activerecord_rake_tasks_does_not_exist", + "sharpstone/ci_fails_ruby_default_bundler" ] } diff --git a/hatchet.lock b/hatchet.lock index b8130049a..55338f9c1 100644 --- a/hatchet.lock +++ b/hatchet.lock @@ -15,6 +15,8 @@ - 116db685f54dae18f703b3beb90e64fdbddb048d - - "./repos/ci/activerecord_rake_tasks_does_not_exist" - a6b711be6921cf7a0aa4e31269c37965799ea110 +- - "./repos/ci/ci_fails_ruby_default_bundler" + - 43cbf196245957be6242b1e1bc56b8f1bfa00004 - - "./repos/ci/heroku-ci-json-example" - 4e5410a7381f486ba3df7739e02e52f32fdd4dda - - "./repos/ci/rails5_ruby_schema_format" diff --git a/spec/hatchet/ci_spec.rb b/spec/hatchet/ci_spec.rb index 3b1d2e230..82a4c57ac 100644 --- a/spec/hatchet/ci_spec.rb +++ b/spec/hatchet/ci_spec.rb @@ -38,4 +38,10 @@ expect(test_run.output).to_not match("db:migrate") end end + + it "works when using a Ruby version different from default with an older version of bundler and not declaring a test script" do + Hatchet::Runner.new("ci_fails_ruby_default_bundler").run_ci do |test_run| + expect(test_run.output).to match("rspec") + end + end end