Skip to content

Redo: Run Bundler v1 helpers with explicit version - #3223

Merged
feelepxyz merged 1 commit into
mainfrom
feelepxyz/revert-revert-pull-3196
Mar 8, 2021
Merged

Redo: Run Bundler v1 helpers with explicit version#3223
feelepxyz merged 1 commit into
mainfrom
feelepxyz/revert-revert-pull-3196

Conversation

@feelepxyz

Copy link
Copy Markdown
Contributor

This brings back this revert: #3222

Work in progress to figure out how to run multiple bundler version

@feelepxyz
feelepxyz requested a review from a team as a code owner March 3, 2021 12:18
@feelepxyz feelepxyz changed the title Redo: Run Bundler v1 helpers with explicit version … Redo: Run Bundler v1 helpers with explicit version Mar 3, 2021
@brrygrdn

brrygrdn commented Mar 4, 2021

Copy link
Copy Markdown
Contributor

Test failures aside, I think using Bundler's own environment management is a step in the right direction, I've been able to get a sensible outcome across the three test repos along with our specific git-dependency test https://github.com/dsp-testing/bundler1-git-test

bin/dry-run.rb bundler dsp-testing/bundler1-git-test
=== byebug (fead41cb53d349e11045a05cc804740089dbfa80)
 => checking for updates 1/2
 => latest available version is 11.1.3
 => latest allowed version is 11.1.3
 => requirements to unlock: own
 => requirements update strategy: bump_versions
 => updating byebug from fead41cb53d349e11045a05cc804740089dbfa80 to 11.1.3
    ± Gemfile
    ~~~
    3c3
    < gem "byebug", git: "git@github.com:deivid-rodriguez/byebug.git", ref: "v11.1.0"
    ---
    > gem "byebug"
    ~~~
    ± Gemfile.lock
    ~~~
    1,7d0
    < GIT
    <   remote: git@github.com:deivid-rodriguez/byebug.git
    <   revision: fead41cb53d349e11045a05cc804740089dbfa80
    <   ref: v11.1.0
    <   specs:
    <     byebug (11.1.0)
    <
    11a5
    >     byebug (11.1.3)
    18c12
    <   byebug!
    ---
    >   byebug
    ~~~

Comment thread bundler/lib/dependabot/bundler/native_helpers.rb Outdated
Comment thread bundler/lib/dependabot/bundler/native_helpers.rb Outdated
@brrygrdn brrygrdn self-assigned this Mar 4, 2021
Comment thread bundler/lib/dependabot/bundler/native_helpers.rb Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to match BUNDLE_GEMFILE but not sure it's necessary, both seemed to work inside and outside the container with v1 and v2 installed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed synchronously, I'm 👍🏻 on having versioned_helper_path(bundler_version: bundler_version) as a clean(ish) room bundler path for all things related to the native helper process.

Comment thread bundler/lib/dependabot/bundler/native_helpers.rb Outdated

@brrygrdn brrygrdn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending some further testing, I think this is ready to 🚢 🎉

Since it took a lot of iterations to get this working end to end, how do you feel about squashing the commit history for merge?

@feelepxyz
feelepxyz force-pushed the feelepxyz/revert-revert-pull-3196 branch 2 times, most recently from 7a07768 to d38670d Compare March 5, 2021 15:40
@feelepxyz
feelepxyz requested a review from brrygrdn March 5, 2021 15:40

@brrygrdn brrygrdn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required when running with bundler 2 installed alongside v1, without this it defaults to v2 during dry-runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed synchronously, the use of Find in these gemspecs is atypical and not suggested by Bundler v1.17.x or v2.x.x when generating new gems.

Since Find isn't in the ruby context by default, we'd expect .gemspecs in the real world to have this require

This brings back this revert:
#3222

We've wrapped bundler native helpers in `Bundler.with_original_env` to
use the env before bundler was initialised in core.

This removed the need to manually unset env vars like `GEM_HOME` and
`GEM_PATH` which caused bundler to default git install to
`/var/lib/gems/2.6.0/cache/bundler/git` when run in the parent
container, where it doesn't have write permission.

With this change the the bundle cache is written to the native helper
folder/.bundle.

Co-authored-by: Barry Gordon <brrygrdn@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants