Revert "Revert "Revert "Revert "Install Bundled Gems in Deployment Mode"""" #67642
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.
Reverts #67639, re-reapplying #66536
The last attempt applied successfully at first, but a subsequent build revealed that it introduced a circular dependency problem when trying to process Gemfile changes.
Specifically, in order to successfully run a bundle operation which processes a Gemfile change from within a Ruby processes started within the bundle environment, it's important to spawn the subshell without any of the
BUNDLE_*environment variables set by the original process. Bundle provides awith_unbundled_envhelper for doing so, but we weren't using it; we were instead running all bundle operations withsudo, which has a side effect of stripping out all environment variables.Since we are now running
bundle installwithoutsudo, we need to make sure to usewith_unbundled_envinstead.Links
Slack thread
Testing Story
Tested on an adhoc; I first verified that without this fix, the adhoc will fail to install a new gem in the same way our build pipeline servers failed. I then verified that with the fix in place, the adhoc can successfully install a new gem.