Skip to content

Add full environment to rake gitlab:elastic:index

Dmitry Gruzd requested to merge fix-elastic-rake-task into master

What does this MR do and why?

This MR fixes a ~"technical debt" issue. Currently, we don't have a full rails environment for rake gitlab:elastic:index. Now it works by accident because we invoke other rake tasks with the :environment flag before invoking the rails code. For example, if we remove these lines, the rake task will fail with

$ bin/rake gitlab:elastic:index
rake aborted!
NameError: uninitialized constant Gitlab::SafeRequestStore
/Users/dgruzd/projects/gdk-ee/gitlab/lib/gitlab/current_settings.rb:15:in `current_application_settings'
/Users/dgruzd/projects/gdk-ee/gitlab/lib/gitlab/current_settings.rb:32:in `method_missing'
/Users/dgruzd/projects/gdk-ee/gitlab/ee/lib/tasks/gitlab/elastic.rake:16:in `block (3 levels) in <main>'
Tasks: TOP => gitlab:elastic:index
(See full trace by running task with --trace)

which can be very confusing. I think we should explicitly require full environment for this rake task.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

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 Dmitry Gruzd

Merge request reports

Loading