debian-mirror-gitlab/lib/tasks/gitlab/artifacts/migrate.rake

38 lines
1.1 KiB
Ruby
Raw Normal View History

2018-05-09 12:01:36 +05:30
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)
2019-12-21 20:55:43 +05:30
logger.info('Starting transfer of artifacts to remote storage')
2018-05-09 12:01:36 +05:30
2019-12-21 20:55:43 +05:30
helper = Gitlab::Artifacts::MigrationHelper.new
2018-05-09 12:01:36 +05:30
2019-12-21 20:55:43 +05:30
begin
helper.migrate_to_remote_storage do |artifact|
logger.info("Transferred artifact ID #{artifact.id} of type #{artifact.file_type} with size #{artifact.size} to object storage")
end
rescue => e
logger.error(e.message)
end
end
task migrate_to_local: :environment do
logger = Logger.new(STDOUT)
logger.info('Starting transfer of artifacts to local storage')
helper = Gitlab::Artifacts::MigrationHelper.new
2019-07-07 11:18:12 +05:30
2019-12-21 20:55:43 +05:30
begin
helper.migrate_to_local_storage do |artifact|
logger.info("Transferred artifact ID #{artifact.id} of type #{artifact.file_type} with size #{artifact.size} to local storage")
end
2019-07-07 11:18:12 +05:30
rescue => e
2019-12-21 20:55:43 +05:30
logger.error(e.message)
2018-05-09 12:01:36 +05:30
end
end
end
end