Ensure support/exec-cd runs bundler in a clean state and ruby version managers work as expected
What does this merge request do and why?
Previous code that relies on just exec
carries over Bundler and whatever ruby version manager solution you use (RVM, rbenv, asdf...).
It doesn't have a side-effect when both versions of ruby are the same, but can break when gdk
version differs from the one in gitlab
folder, as example.
This changes how commands are invoked by starting a new shell login process, which resets the environment but also loads whatever version manager logic is required.
How to test
You can run the following snippet on before and after:
support/exec-cd gitlab ruby --version
Before it should report:
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin21]
After it should report:
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
To validate it also isolates Bundler, you can run this:
support/exec-cd gitlab bundle env | wc -l
You should get a different number before and after (mine, before: 301
, after: 2549
)
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.
Closes #1600 (closed)