Add API to mark migrations as successful
What does this MR do and why?
For CI partitioning we have added lots of migrations and some of them failed because of external factors(too much traffic, conflicting locks due to vacuum) and we had to create change management issues to mark the migrations as successfully executed and unblock the release process. This MR adds an API endpoint for this and it will be used by a chatops command to make the process easier and faster: gitlab-com/chatops!381 (merged)
The last occurrence: gitlab-com/gl-infra/production#14888 (closed)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- in
development.rb
changeconfig.active_record.migration_error = :page_load
toconfig.active_record.migration_error = :false
so that the server boots successfully. - generate a migration file
bin/rails g post_deployment_migration test_api_migration_skip
- Get the version number for the generated migration and use it in the following command
curl -H 'PRIVATE-TOKEN: glpat-token' -X POST 'http://localhost:3000/api/v4/admin/migrations/:version/mark?database=main' -v
- check the main database
gdk psql
,select * from schema_migrations where version = ':version';
- Repeat with the
ci
database.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Marius Bobin