Prevent upgrade when background migrations are still running
### Summary In [Upgrade recommendations](https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations) we recommend that users do an update in steps instead of large version jumps. \ In [Upgrading without downtime](https://docs.gitlab.com/ee/update/#upgrading-without-downtime) it says > Certain major/minor releases may require a set of background migrations to be finished. To guarantee this such a release will process any remaining jobs before continuing the upgrading procedure. While this won’t require downtime (if the above conditions are met) we recommend users to keep at least 1 week between upgrading major/minor releases, allowing the background migrations to finish. This note is easily missed. When users do an upgrade in steps, they might start installing a new version while the background migrations of the just installed version are still running. ### Proposal The installation of a new version should be blocked automatically when background migrations are still running. This will prevent possible installation errors later on. There were some concerns about blocking upgrades for migrations on any kind of upgrade jump, as this could effectively slow down upgrades of simpler scenarios, which could affect users unnecessarily. So, initially we agreed to only block upgrades on current running required stop versions, which as our [documentation indicates](https://docs.gitlab.com/ee/update/#required-upgrade-stops): > Required upgrade stops allow required background migrations to finish. It's also been raised that blocking uses completely even in upgrade stops could be harmful, as they couldn't for instance upgrade to the next patch version which could include an important security release. So we'd like also to implement some sort of skipping mechanism to allow the users to tell the upgrade ignore the background migrations if they need to. See: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4501#note_1894733208 ### References This is in the same vein as [Set 11.11 to be the minimum version to upgrade to 12.0](https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests/3299) but then the functionality of `/lib/system_check/app/migrations_are_up_check.rb` should be called in `/config/templates/package-scripts/preinst.rb`. Customer hurt by this: https://gitlab.zendesk.com/agent/tickets/125960 (internal use only) <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION --> *This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.* <!-- triage-serverless v3 PLEASE DO NOT REMOVE THIS SECTION -->
issue