diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-05 16:20:45 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-05 16:20:45 +0000 |
commit | d298fad0c0564454271cba11e6f20c19681534ac (patch) | |
tree | 0a19d07d8b3bdd2574617305c300e404f2ace581 /lib/tasks/gitlab/pages.rake | |
parent | c9f9eec79cab801a50db698f682aacffbedf07f7 (diff) | |
download | gitlab-ce-1ca13fc6800d22bb81a53919fc2d7b41d89c2a6d.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc41
Diffstat (limited to 'lib/tasks/gitlab/pages.rake')
-rw-r--r-- | lib/tasks/gitlab/pages.rake | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/tasks/gitlab/pages.rake b/lib/tasks/gitlab/pages.rake index e15cbb4e32e..59c57a66928 100644 --- a/lib/tasks/gitlab/pages.rake +++ b/lib/tasks/gitlab/pages.rake @@ -6,30 +6,20 @@ namespace :gitlab do task migrate_legacy_storage: :gitlab_environment do logger = Logger.new(STDOUT) logger.info('Starting to migrate legacy pages storage to zip deployments') - processed_projects = 0 - ProjectPagesMetadatum.only_on_legacy_storage.each_batch(of: 10) do |batch| - batch.preload(project: [:namespace, :route, pages_metadatum: :pages_deployment]).each do |metadatum| - project = metadatum.project + result = ::Pages::MigrateFromLegacyStorageService.new(logger, migration_threads, batch_size).execute - result = nil - time = Benchmark.realtime do - result = ::Pages::MigrateLegacyStorageToDeploymentService.new(project).execute - end - processed_projects += 1 + logger.info("A total of #{result[:migrated] + result[:errored]} projects were processed.") + logger.info("- The #{result[:migrated]} projects migrated successfully") + logger.info("- The #{result[:errored]} projects failed to be migrated") + end - if result[:status] == :success - logger.info("project_id: #{project.id} #{project.pages_path} has been migrated in #{time} seconds") - else - logger.error("project_id: #{project.id} #{project.pages_path} failed to be migrated in #{time} seconds: #{result[:message]}") - end - rescue => e - logger.error("#{e.message} project_id: #{project&.id}") - Gitlab::ErrorTracking.track_exception(e, project_id: project&.id) - end + def migration_threads + ENV.fetch('PAGES_MIGRATION_THREADS', '3').to_i + end - logger.info("#{processed_projects} pages projects are processed") - end + def batch_size + ENV.fetch('PAGES_MIGRATION_BATCH_SIZE', '10').to_i end end end |