Welcome to mirror list, hosted at ThFree Co, Russian Federation.

repository_import_worker.rb « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d7e759fb4701f2bb9bf059e997375f8bda3b0a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)

    result_of_data_import = if project.import_type == 'github'
                              Gitlab::GithubImport::Importer.new(project).execute
                            elsif project.import_type == 'gitlab'
                              Gitlab::GitlabImport::Importer.new(project).execute
                            elsif project.import_type == 'bitbucket'
                              Gitlab::BitbucketImport::Importer.new(project).execute
                            else
                              true
                            end

    if result && result_of_data_import
      project.import_finish
      project.save
      project.satellite.create unless project.satellite.exists?
      project.update_repository_size
    else
      project.import_fail
    end
  end
end