Commit b2777f4b authored by Steve Abrams's avatar Steve Abrams

Add all_plans phase 2 feature flag

Add a feature flag to control if all plans
qualify for registry import in phase 2 of the
container registry migration.
parent ea68d14f
---
name: container_registry_migration_phase2_all_plans
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/83135
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350543
milestone: '14.10'
type: development
group: group::package
default_enabled: false
......@@ -26,6 +26,7 @@ module EE
# self-managed instances are singlular plans, so they do not need
# these filters
return all unless ::Gitlab.com?
return all if ::ContainerRegistry::Migration.all_plans?
if ::ContainerRegistry::Migration.limit_gitlab_org?
joins(project: [:namespace]).where(namespaces: { path: GITLAB_ORG_NAMESPACE })
......
......@@ -25,16 +25,26 @@ RSpec.describe ContainerRepository, :saas do
stub_application_setting(container_registry_import_target_plan: subscription.hosted_plan.name)
end
context 'limit_gitlab_org enabled' do
it { is_expected.to contain_exactly(gitlab_container_repository) }
end
context 'limit_gitlab_org disabled' do
context 'all_plans disabled' do
before do
stub_feature_flags(container_registry_migration_limit_gitlab_org: false)
stub_feature_flags(container_registry_migration_phase2_all_plans: false)
end
context 'limit_gitlab_org enabled' do
it { is_expected.to contain_exactly(gitlab_container_repository) }
end
it { is_expected.to contain_exactly(valid_container_repository) }
context 'limit_gitlab_org disabled' do
before do
stub_feature_flags(container_registry_migration_limit_gitlab_org: false)
end
it { is_expected.to contain_exactly(valid_container_repository) }
end
end
context 'all_plans and limit_gitlab_org enabled' do
it { is_expected.to contain_exactly(valid_container_repository, ultimate_container_repository, gitlab_container_repository) }
end
end
......
......@@ -49,5 +49,9 @@ module ContainerRegistry
def self.target_plan
Plan.find_by_name(target_plan_name)
end
def self.all_plans?
Feature.enabled?(:container_registry_migration_phase2_all_plans)
end
end
end
......@@ -165,4 +165,18 @@ RSpec.describe ContainerRegistry::Migration do
expect(described_class.target_plan).to eq(plan)
end
end
describe '.all_plans?' do
subject { described_class.all_plans? }
it { is_expected.to eq(true) }
context 'feature flag disabled' do
before do
stub_feature_flags(container_registry_migration_phase2_all_plans: false)
end
it { is_expected.to eq(false) }
end
end
end
......@@ -18,7 +18,8 @@ RSpec.shared_context 'importable repositories' do
stub_application_setting(container_registry_import_created_before: 1.day.ago)
stub_feature_flags(
container_registry_phase_2_deny_list: false,
container_registry_migration_limit_gitlab_org: false
container_registry_migration_limit_gitlab_org: false,
container_registry_migration_phase2_all_plans: false
)
Feature::FlipperGate.create!(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment