Migrations when upgrading from 11.11.x to master (12.3.pre) throw error
Summary
When upgrading to master (using omnibus nightlies) from 11.11.x, the following error is thrown during the migrations:
execute("UPDATE \"application_settings\" SET \"allow_local_requests_from_web_hooks_and_services\" = \"application_settings\".\"allow_local_requests_from_hooks_and_services\" WHERE \"application_settings\".\"id\" >= 1")NOTICE: trigger "trigger_806273a4d8be" for relation "application_settings" does not exist, skipping
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Could not save prometheus manual configuration
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database_importers/self_monitoring/project/create_service.rb:39:in `execute!'
/opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20190801072937_add_gitlab_instance_administration_project.rb:7:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:49:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Running reconfigure a second time fixes the issue. If we take a look in the application logs we can see a better error message:
September 09, 2019 15:35: Could not save prometheus manual configuration for self-monitoring project. Errors: ["Api url is blocked: Requests to localhost are not allowed"]
Steps to reproduce
Checkout the 11.11.8 version of gitlab, and reset your database to ensure it's accurate for that tag. Ensure gitlab is running, and checkout master, and then run migrations.
This can also be done with the 11.11.8 omnibus package, and then installing the latest nightly package.
Possible fixes
The problematic migration is already being moved to a background migration, which will likely solve this issue. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/32819
cc\ @rpereira2 @stanhu
Edited by DJ Mountney