Rake task should check if ElasticSearch (ES) is enabled before checking pending migrations

Summary

Similar to You have pending obsolete migrations shows when... (#431420 - closed) we should check if ES is enabled when we run rake task sudo gitlab-rake gitlab:elastic:list_pending_migrations

This issue was raised via Internal ticket by customer

Steps to reproduce

Disable ES and check elastic pending migrations during upgrade.

Example Project

What is the current bug behavior?

What is the expected correct behavior?

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Do something similar to Hide obsolete migration warning when AS not set up (!137021 - merged) but for Rake Tasks

Edited by Emily Chang