diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-01 11:54:23 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-08-01 11:54:23 +0300 |
commit | bd659f70b18be07dac184ca249c7eee17c703e56 (patch) | |
tree | 0c2091386dc5528f27928d1c5868eea2f140226e /app/workers/repository_import_worker.rb | |
parent | e53e4d45296c32e699b98cefdcb4bcde5e1a44bf (diff) | |
parent | 60943a60d822ea490c65914ca3cec5a488742c93 (diff) |
Merge branch 'fj-6860-instance-level-project-templates' into 'master'
[CE Port]: Implement instance level project templates
See merge request gitlab-org/gitlab-ce!20761
Diffstat (limited to 'app/workers/repository_import_worker.rb')
-rw-r--r-- | app/workers/repository_import_worker.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb index 8c64c513c74..82189a3c9f5 100644 --- a/app/workers/repository_import_worker.rb +++ b/app/workers/repository_import_worker.rb @@ -7,9 +7,9 @@ class RepositoryImportWorker include ProjectImportOptions def perform(project_id) - project = Project.find(project_id) + @project = Project.find(project_id) - return unless start_import(project) + return unless start_import Gitlab::Metrics.add_event(:import_repository) @@ -21,7 +21,7 @@ class RepositoryImportWorker return if service.async? if result[:status] == :error - fail_import(project, result[:message]) if project.gitlab_project_import? + fail_import(result[:message]) if template_import? raise result[:message] end @@ -31,14 +31,20 @@ class RepositoryImportWorker private - def start_import(project) + attr_reader :project + + def start_import return true if start(project) Rails.logger.info("Project #{project.full_path} was in inconsistent state (#{project.import_status}) while importing.") false end - def fail_import(project, message) + def fail_import(message) project.mark_import_as_failed(message) end + + def template_import? + project.gitlab_project_import? + end end |