Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple lock files for Bundler #2106

Closed
paulsturgess opened this issue Sep 25, 2019 · 13 comments
Closed

Support multiple lock files for Bundler #2106

paulsturgess opened this issue Sep 25, 2019 · 13 comments

Comments

@paulsturgess
Copy link

The BootBoot gem makes it very easy to run tests against against future versions of Rails.

When running bundle install it produces a Gemfile_next.lock alongside the usual Gemfile.lock. At the moment Dependabot only checks in the Gemfile.lock and I guess it ignores the Gemfile_next.lock as this is a non-standard file. The result is an error is raised when the CI attempts run bundler before running the tests.

Here's an example of the error output:

Using bundler 2.0.2
Installed plugin bootboot

You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile_next.lock to version control.

The dependencies in your gemfile changed
You have added to the Gemfile:
* activeadmin (~> 2.3.1)
You have deleted from the Gemfile:
* activeadmin (~> 2.2.0)

The command "eval bundle install --jobs=3 --retry=3 --deployment --path=${BUNDLE_PATH:-vendor/bundle} " failed.

It would be great if there was some way to specify any custom lock files (or maybe just any non-standard output) that should be committed by Dependabot. Does this sound like a sane idea?

@feelepxyz
Copy link
Contributor

@paulsturgess thanks for your suggestion! We don't currently support this filename but sounds like we should support Gemfile* and Gemfile*.lock glob pattern when fetching these files.

We're currently have the next six months planned out scaling Dependabot at GitHub so unfortunately don't have capacity to take on any new features while we complete this roll out.

@paulsturgess
Copy link
Author

OK cool thanks for the response. If I was to open a PR would you consider it? I'm not exactly sure where I'd go to do that, if you have any pointers on accepting contributions please let me know!

@feelepxyz
Copy link
Contributor

@paulsturgess for sure happy to review any PR! 😍 You'd want to start here to support fetching multiple Gemfiles and Gemfile.locks:

def gemfile
@gemfile ||= fetch_file_if_present("gems.rb") ||
fetch_file_if_present("Gemfile")
end
def lockfile
@lockfile ||= fetch_file_if_present("gems.locked") ||
fetch_file_if_present("Gemfile.lock")
end
(similar to how we fetch multiple gemspecs).

I'm not sure how much would break if we started fetching multiple Gemfiles but shouldn't be too crazy as we do similar things for other package managers, e.g. Python: https://github.com/dependabot/dependabot-core/blob/master/python/lib/dependabot/python/file_fetcher.rb#L39

@eliotsykes
Copy link

eliotsykes commented Oct 15, 2019

Is there an existing way to support multiple Gemfiles with dependabot? For example, if each Gemfile/.lock was put in a different directory with the standard Gemfile and Gemfile.lock file names, would dependabot's directory config option support this?

app/
  - Gemfile
  - Gemfile.lock

  # Separate app/gemfile_next/ directory
  # to hold other Gemfile and Gemfile.lock
  - gemfile_next/
    - Gemfile
    - Gemfile.lock

@feelepxyz
Copy link
Contributor

Is there an existing way to support multiple Gemfiles with dependabot? For example, if each Gemfile/.lock was put in a different directory with the standard Gemfile and Gemfile.lock file names, would dependabot's directory config option support this?

@eliotsykes yep this would work!

paulsturgess referenced this issue in paulsturgess/dependabot-core Nov 19, 2019
The BootBoot gem makes it very easy to run tests against
against future versions of Rails.

When running bundle install it produces a Gemfile_next.lock
alongside the usual Gemfile.lock. At the moment Dependabot
only fetches the standard Gemfile.lock

This commit enables the Bundler::FileFetcher to fetch
all Gemfile.lock files and all Gemfile versions.

https://github.com/dependabot/feedback/issues/689
paulsturgess referenced this issue in paulsturgess/dependabot-core Nov 19, 2019
The BootBoot gem makes it very easy to run tests against
against future versions of Rails.

When running bundle install it produces a Gemfile_next.lock
alongside the usual Gemfile.lock. At the moment Dependabot
only fetches the standard Gemfile.lock

This commit enables the Bundler::FileFetcher to fetch
all Gemfile.lock files and all Gemfile versions.

https://github.com/dependabot/feedback/issues/689
@JacobEvelyn
Copy link

Is there an existing way to support multiple Gemfiles with dependabot? ...

yep this would work!

@feelepxyz this isn't working for me. I made a test repo with two Gemfiles (one in the root and one in the .overcommit directory), and set them both in the directory config option in .dependabot/config.yml and I get this Dependabot error:

The property '#/update_configs/0/directory' of type array did not match the following type: string

It seems only one directory can be used? Or am I missing something?

@feelepxyz
Copy link
Contributor

@JacobEvelyn you'll need to create a new update config entry for each directory:

version: 1
update_configs:
  - package_manager: "ruby:bundler"
    directory: "/"
    update_schedule: "live"
  - package_manager: "ruby:bundler"
    directory: "/.overcommit"
    update_schedule: "live"

@JacobEvelyn
Copy link

Ah perfect, looks like that works!

@infin8x infin8x transferred this issue from dependabot/feedback Jun 29, 2020
@infin8x
Copy link
Contributor

infin8x commented Jul 20, 2020

Looks like you've got this working via multiple update_configs, so closing for now.

@infin8x infin8x closed this as completed Jul 20, 2020
@ashkulz
Copy link

ashkulz commented Oct 30, 2020

@infin8x it doesn't work for us, see my latest comment in #2231

@davidwessman
Copy link

I solved this problem by adding a Github Action workflow which updates Gemfile.next.lock everytime Dependabot updates Gemfile.lock. It does not have as nice update logic as Dependabot but help keeping the Gemfile.next deployable!

I wrote it up in a blog post:
https://wessman.co/rails-dual-boot-with-dependabot

@davidwessman
Copy link

davidwessman commented Mar 11, 2021

@infin8x Can we open up this issue again?
Now my solution and my tests fail since the change to only read-permissions from the 1st of March.
https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/

Or should I create a new PR issue?

@infin8x
Copy link
Contributor

infin8x commented Mar 11, 2021

Unfortunately I'm not on the Dependabot team anymore. @hmarr or @feelepxyz may be able to get you in the right direction.

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 a pull request may close this issue.

7 participants