Common metrics importer migration should be scoped to Rails.root
The part of the code in question is here: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/db/importers/common_metrics_importer.rb#L38
And causes issues if the rake command is not called from the rails root directory.
Example of the error:
== 20180826111825 RecalculateSiteStatistics: migrating ========================
-- transaction()
-- execute("SET LOCAL statement_timeout TO 0")
-> 0.0004srake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
No such file or directory @ rb_sysopen - config/prometheus/common_metrics.yml
/srv/gitlab/db/importers/common_metrics_importer.rb:39:in `initialize'
/srv/gitlab/db/migrate/20180831164910_import_common_metrics.rb:11:in `new'
/srv/gitlab/db/migrate/20180831164910_import_common_metrics.rb:11:in `up'
In the above case, the file existed in the correct location in the rails root, but the db:migrate rake command was called from a directory other than the rails root.
We are currently experiencing this error in the cloud native project (on a migration from a 11.0.x dataset to master) https://gitlab.com/charts/gitlab/issues/742