Skip to content

Fix require path

Linjie Zhang requested to merge gitlab-jh/jh-team/gitlab:fix-require-path into master

What does this MR do and why?

fix require path to require_relative

include MR: !129494 (merged)

omnibus runtime error:

 bundler: failed to load command: puma (/opt/gitlab/embedded/bin/puma)
 <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require': cannot load such file -- ./ee/db/seeds/shared/dora_metrics (LoadError)
 	from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
 	from /opt/gitlab/embedded/service/gitlab-rails/ee/lib/quality/seeders/insights/issues.rb:3:in `<top (required)>'
 	from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
 	from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:30:in `require'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/helpers.rb:135:in `const_get'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/helpers.rb:135:in `cget'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:169:in `block in actual_eager_load_dir'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/helpers.rb:25:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/helpers.rb:25:in `ls'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:164:in `actual_eager_load_dir'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:16:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader.rb:297:in `block in eager_load_all'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader.rb:295:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/zeitwerk-2.6.7/lib/zeitwerk/loader.rb:295:in `eager_load_all'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/application/finisher.rb:74:in `block in <module:Finisher>'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:32:in `instance_exec'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:32:in `run'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:61:in `block in run_initializers'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `tsort_each_child'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `call'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `tsort_each_child'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `call'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `tsort_each_child'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `call'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `tsort_each_child'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `call'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:50:in `tsort_each_child'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `call'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:347:in `each'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:347:in `call'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
 	from /opt/gitlab/embedded/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/initializable.rb:60:in `run_initializers'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/railties-7.0.6/lib/rails/application.rb:372:in `initialize!'
 	from /opt/gitlab/embedded/service/gitlab-rails/config/environment.rb:7:in `<top (required)>'
 	from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
 	from <internal:/opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
 	from /opt/gitlab/embedded/service/gitlab-rails/config.ru:5:in `block in <main>'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/lib/puma/configuration.rb:366:in `load_rackup'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/lib/puma/configuration.rb:288:in `app'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/lib/puma/runner.rb:158:in `load_and_bind'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/lib/puma/cluster.rb:359:in `run'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/lib/puma/launcher.rb:194:in `run'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/lib/puma/cli.rb:75:in `run'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/puma-6.3.1/bin/puma:10:in `<top (required)>'
 	from /opt/gitlab/embedded/bin/puma:25:in `load'
 	from /opt/gitlab/embedded/bin/puma:25:in `<top (required)>'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:492:in `exec'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:34:in `dispatch'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:28:in `start'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
 	from /opt/gitlab/embedded/lib/ruby/site_ruby/3.0.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
 	from /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
 	from /opt/gitlab/embedded/bin/bundle:25:in `load'
 	from /opt/gitlab/embedded/bin/bundle:25:in `<main>'

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Linjie Zhang

Merge request reports