[Tooling] Fix bundler CI failure by updating bundler with security fix #15895
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
CircleCI seem to recently have updated to
bundlerversion2.2.10(we were using2.1.4before) on their CI images, probably due to the important security issue that got fixed in 2.2.10.That version of bundler generates a
Gemfile.lockthat is slightly different from the one we had (especially to separate gems per source, one of the changes that avoids the security exploit) and also seems to resolve the gems slightly differently, leading to running 2.2.10'sbundle installon aGemfile.lockthat was generated using bundler 2.1.4 to fail to resolve the dependency forrakein some contexts, and thus fail on CI:That happened on WPAndroid, but since WPiOS's CI is now also using bundler 2.2.10, applying the fix here too.
Root Cause
After a lot of debugging and reading the thread in bundler's PR in details, I finally ended up finding the root cause.
This is in fact due to the fact that we use a
source "…" do … endblock to provide the source for our gems in theGemfile, but that block is not applied to thePluginfile, where we import our release-toolkit plugin/gem. This means that the latest version of bundler now resolves this gem and its transitive dependencies only using the local gems (since there are no global remote source provided for that gem), and thus fail to find transitive dependencies likerakefor it there.Solution
After a lot of trial and error, the solution was finally stop using
sourceblocks in theGemfile, and instead only provide the singlesource 'https://rubygems.org'declaration as a single global source applied to the wholeGemfile, which now allows the plugin to also pull the transitive dependencies from that same single global source declaration, and avoid the security risk and the CI failure.To Test
Gemfile.lockchecksum)Related PRs
The same fix has currently been applied to:
I'll P2 about it once the fix is finally applied to all repos and branches.