Renovate: Upgrading bundler version fails

Created on 19 Dec 2019  路  9Comments  路  Source: renovatebot/renovate

What Renovate type are you using?

GitLab app

Describe the bug

RenovateBot is not working for any of my Ruby gems in Gemfile / Gemfile.lock

Did you see anything helpful in debug logs?

Log output from https://app.renovatebot.com/dashboard#gitlab/docspring/docspring/122642834:

DEBUG: bundler command(branch="renovate/bundler-2.x")
{
  "cmd": "docker run --rm -v \"/mnt/renovate/gl/docspring/docspring\":\"/mnt/renovate/gl/docspring/docspring\" -w \"/mnt/renovate/gl/docspring/docspring\" renovate/ruby:2.6.5 bash -l -c \"ruby --version && gem install bundler -v 2.0.2 --no-document && bundle lock --update bundler\""
}
WARN: Failed to generate Gemfile.lock (unknown error)(branch="renovate/bundler-2.x")
{
  "err": {
    "killed": false,
    "code": 7,
    "signal": null,
    "cmd": "docker run --rm -v \"/mnt/renovate/gl/docspring/docspring\":\"/mnt/renovate/gl/docspring/docspring\" -w \"/mnt/renovate/gl/docspring/docspring\" renovate/ruby:2.6.5 bash -l -c \"ruby --version && gem install bundler -v 2.0.2 --no-document && bundle lock --update bundler\"",
    "stdout": "ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]\nSuccessfully installed bundler-2.0.2\n1 gem installed\n",
    "stderr": "Could not find gem 'bundler'.\nDid you mean builder?\n",
    "message": "Command failed: docker run --rm -v \"/mnt/renovate/gl/docspring/docspring\":\"/mnt/renovate/gl/docspring/docspring\" -w \"/mnt/renovate/gl/docspring/docspring\" renovate/ruby:2.6.5 bash -l -c \"ruby --version && gem install bundler -v 2.0.2 --no-document && bundle lock --update bundler\"\nCould not find gem 'bundler'.\nDid you mean builder?\n",
    "stack": "Error: Command failed: docker run --rm -v \"/mnt/renovate/gl/docspring/docspring\":\"/mnt/renovate/gl/docspring/docspring\" -w \"/mnt/renovate/gl/docspring/docspring\" renovate/ruby:2.6.5 bash -l -c \"ruby --version && gem install bundler -v 2.0.2 --no-document && bundle lock --update bundler\"\nCould not find gem 'bundler'.\nDid you mean builder?\n\n    at ChildProcess.exithandler (child_process.js:294:12)\n    at ChildProcess.emit (events.js:198:13)\n    at ChildProcess.EventEmitter.emit (domain.js:448:20)\n    at maybeClose (internal/child_process.js:982:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)"
  }
}

Thanks!

ruby-version priority-3-normal bug

Most helpful comment

I was able to reproduce this and perhaps work out a solution:

  1. If bundler is being updated, install the new version, not the existing
  2. Run bundle update --bundler instead of bundle lock --update bundler

It's probably complicated though if there are multiple dependencies in one branch and bundler is just one of them

All 9 comments

This appears to be specific to upgrading bundler itself. We install the existing version of Bundler into our Ruby image and then run bundle lock --update bundler but this last command is the one failing.

Possible solutions:

  • Maybe we need to install the "new" version of Bundler in this case?
  • Run Bundler like bundler _existing-version_ lock bundler

Can you create a minimum reproduction for the issue? e.g. a repo that has a Gemfile and Gemfile.lock containing the same version of Bundler you have within your project now?

@rarkins Ah I see what happened! I think it was getting this error at the beginning, so that also blocked all of the other gem updates:

Screen Shot 2019-12-19 at 5 24 53 PM

Sure I will create a minimal reproduction in a new GitHub repo

That's not what I would expect though. I thought the failure would only affect bundler itself. If you do repro, can you try to get it failing to update another non-bundler dependency two? i.e. ideally it has two dependencies, both of which error like this. Thanks

Hello, yes I've put together a repo here, with one other outdated gem (listen): https://github.com/ndbroadbent/renovatebot_bundler_update_error

This also has the same problem, where neither bundler nor listen are being updated: https://app.renovatebot.com/dashboard#github/ndbroadbent/renovatebot_bundler_update_error/122694056

This is happening on my local machine too, and I don't really understand why:

$ bundle update bundler
Could not find gem 'bundler'.
$ bundle lock --update bundler
Could not find gem 'bundler'.

I think I might know why the others aren't working though. Because I wasn't 100% sure I had all the bundler commands right, Renovate currently "gives up" after the first failed lock update and won't even try subsequent branches in the same run. This was so that it didn't non-stop fail the same way unnecessarily. But in this case, it seems to be a bundler-specific thing. Maybe we should give up after 2 of the same errors!

Oh I see! That makes sense. I also just realized that I need to call bundle update --bundler. (See: How to Upgrade to Bundler 2). And this only works if the Gemfile contains an open-ended version like: gem 'bundler', '>= 2.0.2'. It doesn't do anything if it's pinned to a specific version. Unfortunately there's no bundle lock --update bundler or bundle lock --update --bundler command.

So I'm not really sure how RenovateBot could handle that, but I think it would need to handle bundler updates as a special case.

The lock file includes the current bundler version, so it seems we need to run something to get that part to update (or.. hack the update manually ourselves, which I'd prefer not to do).

Ref: https://github.com/ndbroadbent/renovatebot_bundler_update_error/blob/70e2b5c8de4bc501f2993fa4c8eab365c19ee2f3/Gemfile.lock#L21-L22

I was able to reproduce this and perhaps work out a solution:

  1. If bundler is being updated, install the new version, not the existing
  2. Run bundle update --bundler instead of bundle lock --update bundler

It's probably complicated though if there are multiple dependencies in one branch and bundler is just one of them

Was this page helpful?
0 / 5 - 0 ratings