repository_import_worker.rb 582 Bytes
Newer Older
1
2
3
4
5
6
class RepositoryImportWorker
  include Sidekiq::Worker
  include Gitlab::ShellAdapter

  sidekiq_options queue: :gitlab_shell

7
  attr_accessor :project, :current_user
8

9
10
11
  def perform(project_id)
    @project = Project.find(project_id)
    @current_user = @project.creator
12

13
    result = Projects::ImportService.new(project, current_user).execute
14

15
    if result[:status] == :error
16
      project.update(import_error: Gitlab::UrlSanitizer.sanitize(result[:message]))
17
18
19
20
      project.import_fail
      return
    end

21
    project.repository.after_import
22
    project.import_finish
23
  end
24
end