Skip to content

Registry migration setting access class

Steve Abrams requested to merge 350732-registry-migration-ff-settings into master

🛤 Context

We are preparing for Phase 2 of the Container Registry migration which involves importing all existing container repositories to the new platform (Phase 1 involved routing all new container repositories to the new platform). See &7316 (closed) for full details of how the import will work.

As we import container repositories, we will be adjusting various feature flags and application settings to control the speed of the migration. It will be helpful to have all of these settings in one place.

🚋 What does this MR do and why?

Adds a new class: ContainerRegistry::Migration to hold all common logic around the various feature flags that will be used to control the migration process. We also add some shortened method names for related application settings so we can access all migration settings from the same place.

These flags will be used throughout the container registry code so it makes sense to centralize them.

This issue: #349744 (closed) will be where most of these settings are accessed. That issue will result in a large MR (or MRs), so it made sense to iterate and keep the MRs smaller, adding this class first.

🖼 Screenshots or screen recordings

Testing a few of the various methods in the console:

[1] pry(main)> ContainerRegistry::Migration.max_retries
=> 3
[2] pry(main)> ContainerRegistry::Migration.capacity
  Feature::FlipperGate Load (1.3ms)  SELECT "feature_gates".* FROM "feature_gates" WHERE "feature_gates"."feature_key" = 'container_registry_migration_phase2_capacity_25' /*application:console,db_config_name:main,line:/lib/feature.rb:95:in `enabled?'*/
  Feature::FlipperGate Load (0.4ms)  SELECT "feature_gates".* FROM "feature_gates" WHERE "feature_gates"."feature_key" = 'container_registry_migration_phase2_capacity_10' /*application:console,db_config_name:main,line:/lib/feature.rb:95:in `enabled?'*/
  Feature::FlipperGate Load (0.3ms)  SELECT "feature_gates".* FROM "feature_gates" WHERE "feature_gates"."feature_key" = 'container_registry_migration_phase2_capacity_1' /*application:console,db_config_name:main,line:/lib/feature.rb:95:in `enabled?'*/
=> 0
[3] pry(main)> ContainerRegistry::Migration.enabled?
  Feature::FlipperGate Load (1.6ms)  SELECT "feature_gates".* FROM "feature_gates" WHERE "feature_gates"."feature_key" = 'container_registry_migration_phase2_enabled' /*application:console,db_config_name:main,line:/lib/feature.rb:95:in `enabled?'*/
=> true
[4] pry(main)> Feature.disable(:container_registry_migration_phase2_enabled)
=> true
[5] pry(main)> ContainerRegistry::Migration.enabled?
=> false

🖥 How to set up and validate locally

These are all backend changes. You could test the various methods in a rails console as in the section above.

🏷 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 #350732 (closed)

Edited by Steve Abrams

Merge request reports