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

23 lines
724 B
Ruby
Raw Normal View History

2018-05-09 12:01:36 +05:30
require 'logger'
desc "GitLab | Migrate LFS objects to remote storage"
namespace :gitlab do
namespace :lfs do
task migrate: :environment do
logger = Logger.new(STDOUT)
logger.info('Starting transfer of LFS files to object storage')
LfsObject.with_files_stored_locally
.find_each(batch_size: 10) do |lfs_object|
2019-05-30 16:15:17 +05:30
begin
lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE)
2018-05-09 12:01:36 +05:30
2019-05-30 16:15:17 +05:30
logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage")
rescue => e
logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}")
end
2018-05-09 12:01:36 +05:30
end
end
end
end