Use BUNDLE_LOCKFILE when detecting the lockfile#919
Open
Thomascountz wants to merge 1 commit into
Open
Conversation
Honor `BUNDLE_LOCKFILE` (added in Bundler 4) when selecting the lockfile used for Bundler version detection, deployment mode, and bundler-cache keys. Without this, workflows using an alternate lockfile can read the wrong `BUNDLED WITH` version and generate cache keys from the wrong lockfile.
ae3fce3 to
a34034a
Compare
ntkme
reviewed
Jun 8, 2026
|
|
||
| if (fs.existsSync(gemfilePath)) { | ||
| return [gemfilePath, `${gemfilePath}.lock`] | ||
| return [gemfilePath, lockfilePath || `${gemfilePath}.lock`] |
Collaborator
There was a problem hiding this comment.
Given that we have a fs.existsSync check for BUNDLE_GEMFILE or its default value Gemfile that would thrown an exception if missing, we should probably have fs.existsSync check for BUNDLE_LOCKFILE if it's explicitly set. In this case, unlike the check for gemfilePath, we should not check existence of Gemfile.lock because it's optional.
Member
There was a problem hiding this comment.
I'm not following, the code is fine as-is, no? Because the lockfile is always optional.
eregon
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
If a workflow sets
BUNDLE_LOCKFILE, setup-ruby still assumes${BUNDLE_GEMFILE}.lockorgems.locked. That means it can read the wrongBUNDLED WITHversion, fail to enable deployment mode because it checks the wrong lockfile path, and/or generate a cache key from the wrong lockfile.Bundler added
BUNDLE_LOCKFILEsupport in PR #9059