2017-10-13 12:50:36 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module GithubImport
|
|
|
|
# The ParallelImporter schedules the importing of a GitHub project using
|
|
|
|
# Sidekiq.
|
|
|
|
class ParallelImporter
|
|
|
|
attr_reader :project
|
|
|
|
|
|
|
|
def self.async?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2017-11-15 07:27:37 -05:00
|
|
|
def self.imports_repository?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2018-06-13 14:05:01 -04:00
|
|
|
# This is a workaround for a Ruby 2.3.7 bug. rspec-mocks cannot restore
|
|
|
|
# the visibility of prepended modules. See
|
|
|
|
# https://github.com/rspec/rspec-mocks/issues/1231 for more details.
|
|
|
|
if Rails.env.test?
|
|
|
|
def self.requires_ci_cd_setup?
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-10-13 12:50:36 -04:00
|
|
|
def initialize(project)
|
|
|
|
@project = project
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2020-04-03 05:09:31 -04:00
|
|
|
Gitlab::Import::SetAsyncJid.set_jid(project.import_state)
|
2017-10-13 12:50:36 -04:00
|
|
|
|
|
|
|
Stage::ImportRepositoryWorker
|
|
|
|
.perform_async(project.id)
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2020-04-28 05:09:34 -04:00
|
|
|
|
|
|
|
Gitlab::GithubImport::ParallelImporter.prepend_if_ee('::EE::Gitlab::GithubImport::ParallelImporter')
|