Add all_plans phase 2 feature flag
What does this MR do and why?
We are currently working towards migrating all container repositories to the new container registry database. The migration will be rolled out in stages, working one customer tier at a time. To control this, we have an application setting to tell us the current target tier along with other feature flags to control various settings.
We realized, however, when we are all done, we will want a way to say "ignore the tiers and import anything that might be leftover". Currently there is no way to do this.
This MR adds a new feature flag to allow us to bypass the tier check when GitLab is searching for container repositories that are qualified to be imported.
Screenshots or screen recordings
See below
How to set up and validate locally
- Ensure you have a license (premium or ultimate) in your local setup.
- Create some container repositories locally if you do not already have some
10.times { FactoryBot.create(:container_repository, project: Project.first, created_at: 5.years.ago) }
- Change the project's tier
Plan.create!(name: 'ultimate') GitlabSubscription.create(hosted_plan_id: Plan.last.id, namespace_id: Project.first.namespace.id)
- Update the application setting to a different plan:
ApplicationSetting.update!(container_registry_import_target_plan: 'free')
- Comment out this line from
ee/container_repository.rb
to prevent the guard from bypassing the scope on your local instance:# return all unless ::Gitlab.com?
- Try
ContainerRepository.ready_for_import
, nothing should be returned - Enable the feature flag:
Feature.enable(:container_registry_migration_phase2_all_plans)
- Try
ContainerRepository.ready_for_import
again, the container repositories should be returned
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.
Related to #356147 (closed)