Make 'bundle exec rake' more stable or discourage its use for GDK Rake tasks

Overview

As seen in e.g. bundle exec rake setup_ai_gateway fails with "C... (#2675 - closed), the use of bundle exec rake is problematic because bundle exec pollutes GDK’s environment variables, leading to unrelated failures when spawning Ruby sub-processes in service directories that have different Bundler or Ruby versions.

Impacted categories

The following categories relate to this issue:

Proposal

Either:

  1. Remove the BUNDLER_SETUP variable and Bundler setup argument from the RUBYOPT variable
    • This would alleviate the core issue but might still result in a semi-polluted environment since Bundler sets other variables, such as BUNDLE_GEMFILE or BUNDLE_BIN_PATH. The paths in these variables are Ruby-version specific and might cause other instabilities.
  2. Add a gdk rake [...] helper that acts just like bundle exec rake [...]
    • This would allow us to always go through the GDK.main function, setting up system-relevant environment variables
    • It would also keep the environment clean from any BUNDLE* environment variables