You have pending obsolete migrations shows when indexes are not created or reachable
Summary
We introduced a new banner in 16.3 that shows when there are obsolete elasticsearch migrations. However, it appears that this alert shows even when you have not configured Elasticsearch and the instance is unreachable.
You have pending obsolete migrations
You cannot use Elastic::DataMigrationService.mark_all_as_completed!
to mark the migrations as completed to get rid of the banner because if the service is unreachable it will fail. The migration state seems to be associated with the index and it won't be able to do anything:
/opt/gitlab/embedded/service/gitlab-rails/ee/app/models/elastic/migration_record.rb:19:in `save!': Migrations index is not found (RuntimeError)
Steps to reproduce
Create a new GitLab instance and go to Admin > Settings > Advanced Search. You'll see the banner if the migrations have attempted to run
What is the current bug behavior?
The banner shows when there are pending obsolete migrations regardless of whether or not you have the service enabled.
What is the expected correct behavior?
We should only show the banner when the index is reachable and advanced search is enabled.
Possible fixes
In the advanced_search.html.haml we could probably check to see if @elasticsearch_pending_obsolete_migrations.any?
in addition to checking if it is reachable Gitlab::Elastic::Helper.default.ping?
or the index exists ::Gitlab::Elastic::Helper.default.index_exists?