Draft: Require gitlab-platform-core by path in non-Bundler scripts

What does this MR do and why?

Two scripts run as bare Ruby, not under bundle exec, and the move of Gitlab::Popen into gems/gitlab-platform-core left them requiring it by gem name.

gitlab-platform-core is declared in the Gemfile with path:. Path gems are never installed into GEM_HOME, so require 'gitlab/popen' can only resolve after Bundler has put the gem directory on the load path. Plain RubyGems cannot find it in any environment.

scripts/static-analysis is the broken one today. CI invokes it as fail_on_warnings scripts/static-analysis, which evals the command directly, its header says "We don't have auto-loading here", and every other require in it is a require_relative. Run as intended it now fails with cannot load such file -- gitlab/popen, which breaks the static-analysis job.

bin/lib/feature_generator/shared.rb is the latent one. Its header says the file is intentionally pure-Ruby with no Bundler dependency, and its callers bin/saas-feature.rb and bin/dedicated-feature.rb set up no Bundler. doc/development/ee_features.md documents them as bin/saas-feature.rb my_saas_feature, with no bundle exec. The file's existing require 'httparty' is not a precedent for requiring by name here: httparty is a regular installed gem, so RubyGems can resolve it on its own, while a path gem can never be resolved that way.

Point both at the gem with require_relative, which works with and without Bundler.

The other repointed call sites are left alone, because their invocation path always runs Bundler first. The patched database config loads during the Rails boot. rubocop/check_graceful_task.rb runs under bundle exec rake or RSpec. The JavaScript fixtures helper and the two tooling/lib/tooling/ clients are only loaded from specs. The metrics server and sidekiq cluster files are loaded from daemon entrypoints that already require gitlab/utils/all, itself a path gem.

Context

Part of #635231, which has the plan, verification and risks for this workstream. The tracking issue for the whole slice is #632651.

This MR is stacked on !260359. Until that one merges, the diff also shows the commits of the MRs below it. Review only the last 1 commit(s) on this branch.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

🤖 Generated with Claude Code

Edited by Kamil Trzciński (Claude)

Merge request reports

Loading
Loading