Module: ContainerRegistry::Migration

Defined in:
lib/container_registry/migration.rb,
app/workers/container_registry/migration/guard_worker.rb,
app/workers/container_registry/migration/enqueuer_worker.rb,
app/workers/container_registry/migration/observer_worker.rb

Defined Under Namespace

Classes: EnqueuerWorker, GuardWorker, ObserverWorker

Constant Summary collapse

FREE_TIERS =

Some container repositories do not have a plan associated with them, they will be imported with the free tiers

['free', 'early_adopter', nil].freeze
PREMIUM_TIERS =
%w[premium bronze silver premium_trial].freeze
ULTIMATE_TIERS =
%w[ultimate gold ultimate_trial].freeze
PLAN_GROUPS =
{
  'free' => FREE_TIERS,
  'premium' => PREMIUM_TIERS,
  'ultimate' => ULTIMATE_TIERS
}.freeze

Class Method Summary collapse

Class Method Details

.all_plans?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/container_registry/migration.rb', line 77

def self.all_plans?
  Feature.enabled?(:container_registry_migration_phase2_all_plans)
end

.capacityObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/container_registry/migration.rb', line 57

def self.capacity
  # Increasing capacity numbers will increase the n+1 API calls we can have
  # in ContainerRegistry::Migration::GuardWorker#external_migration_in_progress?
  #
  # TODO: See https://gitlab.com/gitlab-org/container-registry/-/issues/582
  #
  return 40 if Feature.enabled?(:container_registry_migration_phase2_capacity_40)
  return 25 if Feature.enabled?(:container_registry_migration_phase2_capacity_25)
  return 10 if Feature.enabled?(:container_registry_migration_phase2_capacity_10)
  return 5 if Feature.enabled?(:container_registry_migration_phase2_capacity_5)
  return 2 if Feature.enabled?(:container_registry_migration_phase2_capacity_2)
  return 1 if Feature.enabled?(:container_registry_migration_phase2_capacity_1)

  0
end

.delete_container_repository_worker_support?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/container_registry/migration.rb', line 46

def self.delete_container_repository_worker_support?
  Feature.enabled?(:container_registry_migration_phase2_delete_container_repository_worker_support)
end

.dynamic_pre_import_timeout_for(repository) ⇒ Object



81
82
83
# File 'lib/container_registry/migration.rb', line 81

def self.dynamic_pre_import_timeout_for(repository)
  (repository.tags_count * pre_import_tags_rate).seconds
end

.enabled?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/container_registry/migration.rb', line 38

def self.enabled?
  Feature.enabled?(:container_registry_migration_phase2_enabled)
end

.enqueue_waiting_timeObject



50
51
52
53
54
55
# File 'lib/container_registry/migration.rb', line 50

def self.enqueue_waiting_time
  return 0 if Feature.enabled?(:container_registry_migration_phase2_enqueue_speed_fast)
  return 165.minutes if Feature.enabled?(:container_registry_migration_phase2_enqueue_speed_slow)

  45.minutes
end

.limit_gitlab_org?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/container_registry/migration.rb', line 42

def self.limit_gitlab_org?
  Feature.enabled?(:container_registry_migration_limit_gitlab_org)
end

.target_plansObject



73
74
75
# File 'lib/container_registry/migration.rb', line 73

def self.target_plans
  PLAN_GROUPS[target_plan_name]
end