Fix Bundler config scope for custom Gemfiles
What does this MR do?
This MR ensures that all Bundler commands use the same application context when GITLAB_BUNDLE_GEMFILE points to a nested Gemfile.
The root .bundle/config entry is retained because the installed-package runtime helper uses it to locate the custom Gemfile. An absolute BUNDLE_GEMFILE is also passed to subsequent Bundler commands so that force_ruby_platform, build.*, frozen, and without settings are written to and read from the custom application root consistently.
This fixes native extension build options being silently ignored for custom Gemfiles, including:
io-event --disable-epoll_pwait2ruby-magic --with-magic-flags=--disable-zstdlibforce_ruby_platform
The default root Gemfile build path is unchanged.
Changelog: fixed
Related issues
Closes #10076 (closed)
Related to:
Test plan
The behavior was reproduced and verified with:
- Bundler 4.0.12
- Ruby 3.3.12
- AlmaLinux 9 builder image revision 5.65.0
GITLAB_BUNDLE_GEMFILE=jh/Gemfile
Before this change:
ruby extconf.rb
epoll_pwait2@GLIBC_2.35
magic.so -> libzstd.so.1After this change:
ruby extconf.rb --disable-epoll_pwait2
ruby extconf.rb --with-magic-flags=--disable-zstdlibThe resulting native extensions no longer reference epoll_pwait2@GLIBC_2.35 or depend on libzstd.so.1.