Allow Release Managers to identify which package introduced a specific post-migration
As part of &585 (closed), we need to keep track of the auto-deploy packages with post-migrations included. This would be helpful for Release Managers during:
- Rollbacks: To analyze until which package we can rollback
- Release process: To determine post-migrations that can be included in the monthly release (only those executed on GitLab.com will be included)
- Incident visibility
Particularly, we need to have visibility about the relationship between auto-deploy packages and post-deployment migrations to help Release Managers answer the question of which package introduced a specific post-migration.
Proposal - Log auto-deploy packages that contain post-migrations
To keep control over auto-deploy packages that introduced post-migrations we should log them on the release issue (similar to what we do with production deploy comments).
To log a comment we need to
- Analyze the diff in a package and verify if it includes a post-migration
- If it does, extend the
metrics:start_timejob to post a comment on the release task issue. This is so that we only post the comment after thewait:helmandwait:omnibusjobs have completed. - The comment should indicate:
- Auto-deploy package
- The post-migrations that were added.
Later on, we could build a dedicated issue just to keep a cleaner track of post-deployment migration and/or a Slack command that helps us quickly identify the package that introduced a specific migration.
Additional options explored
Option A: Extend the QA issue
We could extend the QA issue with a new "Post-migration" section that lists the MRs that introduced post-migrations. Although this gives us visibility the information would be spread across several issues, and not very intuitive to find.
Option B: Slack command
We could build a Slack command that receives a post-migration file name and returns the package that introduces it. This could help on a case-by-case basis but it doesn't help to have the full picture.
Option C: Dedicated post-migration issue
We could have a dedicated issue in release/tasks that logs all the packages that introduce post-migrations.
Example
Release 14.8
14.8.202202080920-97d6e07c2a1.4ce763dbce1
db/post_migrate/20220201173212_add_user_details_provisioning_index.rbdb/post_migrate/20220201141705_cleanup_background_migration_populate_test_reports_issue_id.rb
14.8.202202081520-749786570ad.ee932958e0c
Option D: Have a dedicated environment
We could build a dedicated environment on GitLab Security that logs a deployment every time a post-migration is included in each package.
Implementation
We modified the metrics:start_time job to also post a note to the monthly issue if a package contains post-deploy migrations. The diff is obtained by comparing to the package on gstg-cny.
This change is behind a feature flag called: post_deploy_migrations_note.
Follow-up:
-
Rename the metrics:start_timejob since now, it also posts the post-deploy migration list to the monthly issue - gitlab-org/release-tools!1756 (merged). -
Remove feature flag - https://ops.gitlab.net/gitlab-org/release/tools/-/feature_flags/217/edit.