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

38 lines
1.5 KiB
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
namespace :gitlab do
namespace :uploads do
2018-12-05 23:21:45 +05:30
namespace :migrate do
desc "GitLab | Uploads | Migrate all uploaded files to object storage"
task all: :environment do
2020-04-08 14:13:33 +05:30
Gitlab::Uploads::MigrationHelper.categories.each do |args|
2018-12-05 23:21:45 +05:30
Rake::Task["gitlab:uploads:migrate"].invoke(*args)
Rake::Task["gitlab:uploads:migrate"].reenable
end
end
end
# The following is the actual rake task that migrates uploads of specified
# category to object storage
desc 'GitLab | Uploads | Migrate the uploaded files of specified type to object storage'
2019-12-21 20:55:43 +05:30
task :migrate, [:uploader_class, :model_class, :mounted_as] => :environment do |_t, args|
2021-09-04 01:27:46 +05:30
Gitlab::Uploads::MigrationHelper.new(args, Logger.new($stdout)).migrate_to_remote_storage
2018-05-09 12:01:36 +05:30
end
2019-12-21 20:55:43 +05:30
namespace :migrate_to_local do
desc "GitLab | Uploads | Migrate all uploaded files to local storage"
task all: :environment do
2020-04-08 14:13:33 +05:30
Gitlab::Uploads::MigrationHelper.categories.each do |args|
2019-12-21 20:55:43 +05:30
Rake::Task["gitlab:uploads:migrate_to_local"].invoke(*args)
Rake::Task["gitlab:uploads:migrate_to_local"].reenable
end
end
2018-05-09 12:01:36 +05:30
end
2019-12-21 20:55:43 +05:30
desc 'GitLab | Uploads | Migrate the uploaded files of specified type to local storage'
task :migrate_to_local, [:uploader_class, :model_class, :mounted_as] => :environment do |_t, args|
2021-09-04 01:27:46 +05:30
Gitlab::Uploads::MigrationHelper.new(args, Logger.new($stdout)).migrate_to_local_storage
2018-05-09 12:01:36 +05:30
end
end
end