Commit 1a20b1ce authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '297392-follow-up-from-refactor-pages-migration-services' into 'master'

Separately report successfully migrated pages projects and ones which errored

See merge request gitlab-org/gitlab!51706
parents ffffd1c4 92290ece
......@@ -6,7 +6,8 @@ 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
projects_migrated = 0
projects_errored = 0
ProjectPagesMetadatum.only_on_legacy_storage.each_batch(of: 10) do |batch|
batch.preload(project: [:namespace, :route, pages_metadatum: :pages_deployment]).each do |metadatum|
......@@ -16,20 +17,26 @@ namespace :gitlab do
time = Benchmark.realtime do
result = ::Pages::MigrateLegacyStorageToDeploymentService.new(project).execute
end
processed_projects += 1
if result[:status] == :success
logger.info("project_id: #{project.id} #{project.pages_path} has been migrated in #{time} seconds")
projects_migrated += 1
else
logger.error("project_id: #{project.id} #{project.pages_path} failed to be migrated in #{time} seconds: #{result[:message]}")
projects_errored += 1
end
rescue => e
projects_errored += 1
logger.error("#{e.message} project_id: #{project&.id}")
Gitlab::ErrorTracking.track_exception(e, project_id: project&.id)
end
logger.info("#{processed_projects} pages projects are processed")
logger.info("#{projects_migrated} projects are migrated successfully, #{projects_errored} projects failed to be migrated")
end
logger.info("A total of #{projects_migrated + projects_errored} projects were processed.")
logger.info("- The #{projects_migrated} projects migrated successfully")
logger.info("- The #{projects_errored} projects failed to be migrated")
end
end
end
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