Class: RepositoryImportWorker

Inherits:
Object
  • Object
show all
Includes:
Gitlab::ShellAdapter, Sidekiq::Worker
Defined in:
app/workers/repository_import_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::ShellAdapter

#gitlab_shell

Instance Attribute Details

#current_userObject

Returns the value of attribute current_user


7
8
9
# File 'app/workers/repository_import_worker.rb', line 7

def current_user
  @current_user
end

#projectObject

Returns the value of attribute project


7
8
9
# File 'app/workers/repository_import_worker.rb', line 7

def project
  @project
end

Instance Method Details

#perform(project_id) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/workers/repository_import_worker.rb', line 9

def perform(project_id)
  @project = Project.find(project_id)
  @current_user = @project.creator

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

  if result[:status] == :error
    project.update(import_error: result[:message])
    project.import_fail
    return
  end

  project.repository.after_import
  project.import_finish
end