Manually start migration for batch 1/2 of largest gitlab-org container repositories

Production Change

Change Summary

Related to Migrate `gitlab-org` to the new registry (gitlab-org/gitlab#369101 - closed). For predictability, we want to migrate the largest container repositories under gitlab-org in two weekends, August 20-21 and 27-28. The automated migration procedure does not allow us to pick specific repositories, nor to do so on a specific date.

This is a request to manually trigger the migration for batch 1 of 2 of the largest gitlab-org container repositories using the Rails console. The target repositories are the following:

  • gitlab-org/gitlab/gitlab-ee-qa
  • gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee
  • gitlab-org/build/cng-mirror/gitlab-geo-logcursor
  • gitlab-org/build/cng-mirror/gitlab-sidekiq-ee
  • gitlab-org/build/cng-mirror/gitlab-toolbox-ee
  • gitlab-org/gitlab-runner/gitlab-runner-helper

While the plan is to migrate this first batch on August 20-21 (weekend), it's fine to execute this change and start their migration of this first batch on the 19th. These will take many hours to pre-import, and therefore the final import (read-only period) will only happen late on the 20th. Still, we should try to execute this change as late as possible on the 19th (as close as possible to August 20 00:00:00 UTC).

Change Details

  1. Services Impacted - ServiceGitLab Rails ServiceContainer Registry
  2. Change Technician - @jennykim-gitlab
  3. Change Reviewer - @skarbek
  4. Time tracking - 10 minutes
  5. Downtime Component - NA

Detailed steps for the change

Change Steps - steps to take to execute the change

Estimated Time to Complete (mins) - 5 minutes

  • Set label changein-progress /label ~change::in-progress

  • Open a Rails console with write permissions and run the following script:

    paths = %w[gitlab-org/gitlab/gitlab-ee-qa gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee gitlab-org/build/cng-mirror/gitlab-geo-logcursor gitlab-org/build/cng-mirror/gitlab-sidekiq-ee gitlab-org/build/cng-mirror/gitlab-toolbox-ee gitlab-org/gitlab-runner/gitlab-runner-helper]
    
    paths.each do |path|
        repo = ContainerRepository.find_by_path(ContainerRegistry::Path.new(path))
        unless repo
            puts "WARNING: #{path} not found, skipping"
            next
        end
        from_status = repo.migration_state
        repo.start_pre_import
        puts "#{path} - transitioned from #{from_status} to #{repo.migration_state}"
    end

    This script will send a request to the registry API to start the pre-import of each repository and mark them as "in progress" on the Rails side (the last part is the only reason why this requires write access to Rails).

  • Report result to @jdrpereira and @jaime. Wait for confirmation before proceeding to the next step. What we want to ensure is that the migration was started for each one of these repositories, not more and not less. To confirm this, we'll need to look at the logs as explained here.

  • Set label changecomplete /label ~change::complete

Rollback

Rollback steps - steps to be taken in the event of a need to rollback this change

Estimated Time to Complete (mins) - 5 minutes

  • Open a Rails console with write permissions and run the following script:

    paths = %w[gitlab-org/gitlab/gitlab-ee-qa gitlab-org/build/omnibus-gitlab-mirror/gitlab-ee gitlab-org/build/cng-mirror/gitlab-geo-logcursor gitlab-org/build/cng-mirror/gitlab-sidekiq-ee gitlab-org/build/cng-mirror/gitlab-toolbox-ee gitlab-org/gitlab-runner/gitlab-runner-helper]
    
    paths.each do |path|
        repo = ContainerRepository.find_by_path(ContainerRegistry::Path.new(path))
        next unless repo
        from_status = repo.migration_state
        repo.force_migration_cancel
        puts "#{path} - transitioned from #{from_status} to #{repo.migration_state}"
    end

    This script will abort any previously started migration. This should only be executed if/once requested by @jdrpereira or @jaime. We never had to do this so far (the GitLab.com migration is +95% complete), but leaving this here for reference regardless.

  • Set label changeaborted /label ~change::aborted

Monitoring

Key metrics to observe

Change Reviewer checklist

C4 C3 C2 C1:

  • Check if the following applies:
    • The scheduled day and time of execution of the change is appropriate.
    • The change plan is technically accurate.
    • The change plan includes estimated timing values based on previous testing.
    • The change plan includes a viable rollback plan.
    • The specified metrics/monitoring dashboards provide sufficient visibility for the change.

C2 C1:

  • Check if the following applies:
    • The complexity of the plan is appropriate for the corresponding risk of the change. (i.e. the plan contains clear details).
    • The change plan includes success measures for all steps/milestones during the execution.
    • The change adequately minimizes risk within the environment/service.
    • The performance implications of executing the change are well-understood and documented.
    • The specified metrics/monitoring dashboards provide sufficient visibility for the change.
      • If not, is it possible (or necessary) to make changes to observability platforms for added visibility?
    • The change has a primary and secondary SRE with knowledge of the details available during the change window.
    • The labels blocks deployments and/or blocks feature-flags are applied as necessary

Change Technician checklist

  • Check if all items below are complete:
    • The change plan is technically accurate.
    • This Change Issue is linked to the appropriate Issue and/or Epic
    • Change has been tested in staging and results noted in a comment on this issue.
    • A dry-run has been conducted and results noted in a comment on this issue.
    • For C1 and C2 change issues, the change event is added to the GitLab Production calendar.
    • For C1 and C2 change issues, the SRE on-call has been informed prior to change being rolled out. (In #production channel, mention @sre-oncall and this issue and await their acknowledgement.)
    • For C1 and C2 change issues, the SRE on-call provided approval with the eoc_approved label on the issue.
    • For C1 and C2 change issues, the Infrastructure Manager provided approval with the manager_approved label on the issue.
    • Release managers have been informed (If needed! Cases include DB change) prior to change being rolled out. (In #production channel, mention @release-managers and this issue and await their acknowledgment.)
    • There are currently no active incidents that are severity1 or severity2
    • If the change involves doing maintenance on a database host, an appropriate silence targeting the host(s) should be added for the duration of the change.
Edited by Jenny Kim