fastruby/heroku-buildpack-multiple-gemfiles

Build failure when deploying to heroku

stoem opened this issue · 2 comments

We're deploying our Rails 3.2 app to heroku and have equipped it for dual boot into 4.2 using the rails next gem.

Apart from the heroku/ruby buildpack, the heroku-buildpack-multiple-gemfiles is the only one we have added.

Observed results
When deploying, the gems for 3.2 are installed successfully. Bundler is then removed and unavailable for the 4.2 gems.

(quoting text because github is making a mess of the code view)

remote: -----> Ruby app detected
remote: -----> Installing bundler 1.17.3
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.7
remote: -----> Installing dependencies using bundler 1.17.3

remote: Bundled gems are installed into './vendor/bundle'
remote: Removing bundler (1.17.3)
remote: Bundle completed (0.47s)
remote: -----> Multiple Gemfiles app detected
remote: -----> In bin/compile
remote: -----> Installing Gemfile.next gems
remote: /tmp/build_10a60e8c/vendor/ruby-2.7.7/lib/ruby/2.7.0/rubygems.rb:277:in 'find_spec_for_exe': Could not find 'bundler' (1.17.3) required by your Gemfile.next.lock. (Gem::GemNotFoundException)
remote: To update to the latest version installed on your system, run 'bundle update --bundler'.
remote: To install the missing version, run 'gem install bundler:1.17.3'

Expected results
Both bundle tasks should complete successfully and gems for Rails 3.2 and 4.2 be installed.

We have been working on a solution that may go into the official heroku/ruby build pack (if they accept it). Thanks for testing it, btw.

fastruby/heroku-buildpack-ruby#2

This appears to be an issue with bundler 1.17.3 and the heroku/ruby buildpack.

The heroku/ruby buildpack will uninstall bundler 1.17.3. I'm not sure if this by design or a bug. The uninstall is triggered in two places: 1) passing the --no-clean flag to bundle install (seems like a bug), and 2) the deliberate bundle clean call.

Some early testing I've done with upgrading bundler to 2.3.25 for both Gemfiles appears to work. Bundler 2.3.25 is not uninstalled. To upgrade bundler:

bundle update --bundler
BUNDLE_GEMFILE=Gemfile.next bundle update --bundler

After those run, confirm the bundler version has been upgraded by looking at the tail of the lock files:

tail -n3 Gemfile.lock 
# should output
BUNDLED WITH
   2.3.25

tail -n3 Gemfile.next.lock 
# should also output
BUNDLED WITH
   2.3.25

Then go back to using the official heroku/ruby buildpack along with https://github.com/fastruby/heroku-buildpack-multiple-gemfiles.

(There's no need to use fastruby/heroku-buildpack-ruby#2)