BigW Consortium Gitlab

repository_import_worker.rb 533 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
class RepositoryImportWorker
  include Sidekiq::Worker
  include Gitlab::ShellAdapter

  sidekiq_options queue: :gitlab_shell

  def perform(project_id)
    project = Project.find(project_id)
    result = gitlab_shell.send(:import_repository,
                               project.path_with_namespace,
                               project.import_url)

    if result
14
      project.import_finish
15 16 17
      project.save
      project.satellite.create unless project.satellite.exists?
    else
18
      project.import_fail
19 20 21
    end
  end
end