Commit fd234d7
committed
Fix CI failure
With the new fix for PATH for `bin/test` Heroku CI users, this was accidentally working. This is the change in that test app:
```
$ git diff HEAD~1
diff --git a/Gemfile.lock b/Gemfile.lock
index 89b041a..b8f5c7a 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,8 +1,10 @@
GEM
remote: https://rubygems.org/
specs:
- minitest (5.11.3)
- rake (12.3.1)
+ minitest (6.0.0)
+ prism (~> 1.5)
+ prism (1.7.0)
+ rake (13.2.1)
PLATFORMS
ruby
```
When the path was fixed it started failing with an error:
```
-----> Running test: rake test
rake aborted!
NoMethodError: undefined method `=~' for an instance of Proc
/app/vendor/bundle/ruby/3.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
-----> Ruby buildpack tests failed with exit status 1
# ./vendor/bundle/ruby/3.3.0/gems/heroku_hatchet-8.0.6/lib/hatchet/test_run.rb:135:in `block in wait!'
# /opt/hostedtoolcache/Ruby/3.3.9/x64/lib/ruby/3.3.0/timeout.rb:186:in `block in timeout'
# /opt/hostedtoolcache/Ruby/3.3.9/x64/lib/ruby/3.3.0/timeout.rb:41:in `handle_timeout'
# /opt/hostedtoolcache/Ruby/3.3.9/x64/lib/ruby/3.3.0/timeout.rb:195:in `timeout'
# ./vendor/bundle/ruby/3.3.0/gems/heroku_hatchet-8.0.6/lib/hatchet/test_run.rb:127:in `wait!'
```
It was working before because previously the path was different:
```
$ which -a rake
vendor/bundle/ruby/3.3.0/bin/rake
/tmp/tmp.V7sALmG2lV/bin//rake
/app/vendor/bundle/bin/rake
/app/vendor/bundle/ruby/3.3.0/bin/rake
```
This called `/app/vendor/bundle/ruby/3.3.0/bin/rake` (expanded from relative path) this is a RubyGems binstub and not a Bundler binstub. That means it does NOT use the Gemfile.lock to load gems. This is the binstub:
```
~ $ cat vendor/bundle/ruby/3.3.0/bin/rake
#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
Gem.use_gemdeps
version = ">= 0.a"
str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('rake', 'rake', version)
else
gem "rake", version
load Gem.bin_path("rake", "rake", version)
end
```
This code will execute this path:
```
load Gem.activate_bin_path('rake', 'rake', version)
```
With a version of `>= 0.a` and produce a load path of `/app/vendor/ruby-3.3.9/lib/ruby/gems/3.3.0/gems/rake-13.1.0/exe/rake` this path is the default gem that ships with Ruby 3.3.0.
But now:
```
$ which -a rake
/app/vendor/bundle/bin/rake
/app/vendor/bundle/ruby/3.3.0/bin/rake
```
This will call `/app/vendor/bundle/bin` which loads bundler and is effectively the same as calling `bundle exec rake`.
```
~ $ cat vendor/bundle/bin/rake
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("rake", "rake")
```
This will use the bundled version of rake such that `Gem.bin_path` returns `/app/vendor/bundle/ruby/3.3.0/gems/rake-12.3.1/exe/rake` and Rake 12.3.1 is used.
Rake 12.3.1 is incompatible with Ruby 3.3 so it fails.
Notably it SHOULD fail as this is what happens when you `git push heroku` on the same code:
```
~ $ rake -v
rake aborted!
NoMethodError: undefined method `=~' for an instance of Proc
/app/vendor/bundle/ruby/3.3.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
```
So the problem is in the app, which needs to be updated.1 parent fe1df2d commit fd234d7
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments