Skip to content

Add all_plans phase 2 feature flag

Steve Abrams requested to merge 356147-enqueuer-null-plans into master

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

  1. Ensure you have a license (premium or ultimate) in your local setup.
  2. 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) }
  3. Change the project's tier
    Plan.create!(name: 'ultimate')
    GitlabSubscription.create(hosted_plan_id: Plan.last.id, namespace_id: Project.first.namespace.id)
  4. Update the application setting to a different plan:
    ApplicationSetting.update!(container_registry_import_target_plan: 'free')
  5. 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?
  6. Try ContainerRepository.ready_for_import, nothing should be returned
  7. Enable the feature flag:
    Feature.enable(:container_registry_migration_phase2_all_plans)
  8. 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.

Related to #356147 (closed)

Edited by David Fernandez

Merge request reports