Welcome to mirror list, hosted at ThFree Co, Russian Federation.

artifacts.rake « gitlab « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 494317d99c7724be13dad85827f7c67204d0bab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'logger'
require 'resolv-replace'

desc "GitLab | Migrate files for artifacts to comply with new storage format"
namespace :gitlab do
  namespace :artifacts do
    task migrate: :environment do
      logger = Logger.new(STDOUT)
      logger.info('Starting transfer of artifacts')

      Ci::Build.joins(:project)
        .with_artifacts_stored_locally
        .find_each(batch_size: 10) do |build|
        begin
          build.artifacts_file.migrate!(ObjectStoreUploader::REMOTE_STORE)
          build.artifacts_metadata.migrate!(ObjectStoreUploader::REMOTE_STORE)

          logger.info("Transferred artifacts of #{build.id} of #{build.artifacts_size} to object storage")
        rescue => e
          logger.error("Failed to transfer artifacts of #{build.id} with error: #{e.message}")
        end
      end
    end
  end
end