2021-02-05 07:09:31 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2012-10-30 07:04:56 -04:00
|
|
|
namespace :gitlab do
|
|
|
|
namespace :import do
|
|
|
|
# How to use:
|
|
|
|
#
|
2017-11-07 14:11:42 -05:00
|
|
|
# 1. copy the bare repos to a specific path that contain the group or subgroups structure as folders
|
|
|
|
# 2. run: bundle exec rake gitlab:import:repos[/path/to/repos] RAILS_ENV=production
|
2012-10-30 07:04:56 -04:00
|
|
|
#
|
|
|
|
# Notes:
|
2014-01-20 04:44:40 -05:00
|
|
|
# * The project owner will set to the first administator of the system
|
|
|
|
# * Existing projects will be skipped
|
2020-01-23 01:08:32 -05:00
|
|
|
desc "GitLab | Import | Import bare repositories from repositories -> storages into GitLab project instance"
|
2017-11-07 14:11:42 -05:00
|
|
|
task :repos, [:import_path] => :environment do |_t, args|
|
|
|
|
unless args.import_path
|
|
|
|
puts 'Please specify an import path that contains the repositories'.color(:red)
|
2017-08-11 06:03:35 -04:00
|
|
|
|
|
|
|
exit 1
|
|
|
|
end
|
|
|
|
|
2017-11-07 14:11:42 -05:00
|
|
|
Gitlab::BareRepositoryImport::Importer.execute(args.import_path)
|
2012-10-30 07:04:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|