Build-image: Improve our build-image to work with bundler v2

Created on 9 Jan 2019  Â·  21Comments  Â·  Source: netlify/build-image

currently in case a Gemfile.lock is built with bundler v2, our CI fails to install gems:

9:26:30 AM: Installing gem bundle
9:26:30 AM: You must use Bundler 2 or greater with this lockfile.

which causes builds to fail. We need to support bundler v2 somehow, perhaps in a method similar to what @kitop proposes here though obviously we need to do something different for bundler v2 when the Gemfile specifies it specifically.

feabuilds medium-priority feature

Most helpful comment

I was able to manually edit Gemfile.lock and set the bundle version to 1.16.0 to get my deploy working again:

 BUNDLED WITH
-   2.0.1
+   1.16.0

I don't know what all changed with the lock file format between Bundler 1.x and 2.x, so your mileage may vary.

All 21 comments

Workaround for now is to use bundler v1 or to upgrade to ruby 2.5.0 or greater, or use our CLI (https://www.netlify.com/docs/cli/) to deploy. We are working on updating our build system so that fixes like this can be faster and that work is blocking a fix here at present (since it will change the nature of the fix)

@fool Can you provide any more details for the "upgrade to ruby 2.5.0" route? I did attempt that route using environment variables to specify Ruby 2.5.1 and it did not work (successful Ruby download/ install, same Bundler error) :(

Another alternative workaround I found was to delete Gemfile.lock (in the repo, rm-ing the file before issuing Jekyll build command didn't work either) and to specify my most important dependencies in Gemfile. That's my currently functioning method, but I'm aware it may lead to dependency issues in future as packages get upgraded in repos.

I am no longer sure of my advice to upgrade to a higher version of ruby, so your workaround is the best I know for now.

We will update the status on this issue when we have any news to share. We are currently doing the work needed to solve it - it isn't forgotten :) (28 Jan 2019)

Any update on this issue?

I have luck using netlify-cli to do netlify deploy. Hopefully this issue get resolved soon.

I was able to manually edit Gemfile.lock and set the bundle version to 1.16.0 to get my deploy working again:

 BUNDLED WITH
-   2.0.1
+   1.16.0

I don't know what all changed with the lock file format between Bundler 1.x and 2.x, so your mileage may vary.

I suspect manually editing the lockfile will work in a lot of cases. Mine diff'd across both Bundler versions showed only that line ("BUNDLED WITH") had changed.

I was able to manually edit Gemfile.lock and set the bundle version to 1.16.0 to get my deploy working again:

 BUNDLED WITH
-   2.0.1
+   1.16.0

I don't know what all changed with the lock file format between Bundler 1.x and 2.x, so your mileage may vary.

Thanks for this!

Any updates? I still cannot use Netlify!!!

 You must use Bundler 2 or greater with this lockfile.
5:41:42 PM: Error during gem install
5:41:42 PM: Error running command: Build script returned non-zero exit code: 1
5:41:42 PM: Failing build: Failed to build site
5:41:43 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
5:41:43 PM: Finished processing build request in 8.433431193s

Stop being dramatic.

You can downgrade bundler or Use ‘netlify-cli’

On Jan 31, 2019, at 2:45 PM, LIC notifications@github.com wrote:

Any updates? I still cannot use Netlify!!!

You must use Bundler 2 or greater with this lockfile.
5:41:42 PM: Error during gem install
5:41:42 PM: Error running command: Build script returned non-zero exit code: 1
5:41:42 PM: Failing build: Failed to build site
5:41:43 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
5:41:43 PM: Finished processing build request in 8.433431193s
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

To install downgraded version of bundler, try:

gem uninstall bundler

Last stable version of bundler befor v2.

gem install bundler --version '1.17.3'

😃

@Itagiba I'm launching an internal beta for a ubuntu xenial image this week. Its coming asap! Very sorry for the delay.

Just run into this error. Any update on when a fix is due please?

@bcomnes Does closing mean this is fixed? I ran into the issue this morning. What is the recommended way of fixing other than downgrading bundler?

@jamesking Sorry, was an automated task that closed it mistakenly. We are launching updated ruby versions by next week which should solve this issue.

This is live now in both images. Use the newer versions of ruby to acquire bundler 2.

Also as a side note, we are investigating how to make our build stages more flexible by providing escape hatches that would let you customize this in any version of ruby.

I have so many sites still using bundler 1.x that i've found migrating to the netlify CLI is easier than upgrading all my sites to use bundler 2.x

Here has been my process for Jekyll sites

$ netlify link
=> go through steps to link your netlify site to the folder you're in
$ jekyll clean
=> cleans your stuff
$ JEKYLL_ENV=production jekyll build
=> builds in prod
$ netlify deploy --prod
=> deploys to production and clears caches and such. 

I was able to manually edit Gemfile.lock and set the bundle version to 1.16.0 to get my deploy working again:

 BUNDLED WITH
-   2.0.1
+   1.16.0

I don't know what all changed with the lock file format between Bundler 1.x and 2.x, so your mileage may vary.

This works like a charm for me! Thanks for saving me some headache. Appreciate it man! :)

I was able to manually edit Gemfile.lock and set the bundle version to 1.16.0 to get my deploy working again:

 BUNDLED WITH
-   2.0.1
+   1.16.0

I don't know what all changed with the lock file format between Bundler 1.x and 2.x, so your mileage may vary.

1.17.3, the latest of major version 1 of bundler, also works

This is live now in both images. Use the newer versions of ruby to acquire bundler 2.

@bcomnes I am still seeing this issue with a new Netlify site I just created today. The site is using ruby-2.6.4. Is there any specific action that needs to be taken to use the new version of Bundler? I noticed that version 2.6.2 (not 2.6.4) is included in the image used for the build (the default image), do I need to use the included version to get the correct version of Bundler?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

armincerf picture armincerf  Â·  8Comments

jlengstorf picture jlengstorf  Â·  4Comments

sileht picture sileht  Â·  6Comments

arlyon picture arlyon  Â·  11Comments

evanrelf picture evanrelf  Â·  10Comments