From ee664acb356f8123f4f6b00b73c1e1cf0866c7fb Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 20 Oct 2022 09:40:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-5-stable-ee --- .../gitlab/github_import/object_importer.rb | 34 +++++++++++++--------- .../concerns/gitlab/github_import/stage_methods.rb | 4 +++ 2 files changed, 24 insertions(+), 14 deletions(-) (limited to 'app/workers/concerns/gitlab') diff --git a/app/workers/concerns/gitlab/github_import/object_importer.rb b/app/workers/concerns/gitlab/github_import/object_importer.rb index c2cd50d8c21..9793278ac0c 100644 --- a/app/workers/concerns/gitlab/github_import/object_importer.rb +++ b/app/workers/concerns/gitlab/github_import/object_importer.rb @@ -37,27 +37,22 @@ module Gitlab importer_class.new(object, project, client).execute - Gitlab::GithubImport::ObjectCounter.increment(project, object_type, :imported) + if increment_object_counter?(object) + Gitlab::GithubImport::ObjectCounter.increment(project, object_type, :imported) + end info(project.id, message: 'importer finished') rescue NoMethodError => e # This exception will be more useful in development when a new # Representation is created but the developer forgot to add a # `:github_identifiers` field. - Gitlab::Import::ImportFailureService.track( - project_id: project.id, - error_source: importer_class.name, - exception: e, - fail_import: true - ) - - raise(e) + track_and_raise_exception(project, e, fail_import: true) rescue StandardError => e - Gitlab::Import::ImportFailureService.track( - project_id: project.id, - error_source: importer_class.name, - exception: e - ) + track_and_raise_exception(project, e) + end + + def increment_object_counter?(_object) + true end def object_type @@ -90,6 +85,17 @@ module Gitlab github_identifiers: github_identifiers ) end + + def track_and_raise_exception(project, exception, fail_import: false) + Gitlab::Import::ImportFailureService.track( + project_id: project.id, + error_source: importer_class.name, + exception: exception, + fail_import: fail_import + ) + + raise(exception) + end end end end diff --git a/app/workers/concerns/gitlab/github_import/stage_methods.rb b/app/workers/concerns/gitlab/github_import/stage_methods.rb index b12c2311ea8..1feaaf917b2 100644 --- a/app/workers/concerns/gitlab/github_import/stage_methods.rb +++ b/app/workers/concerns/gitlab/github_import/stage_methods.rb @@ -63,6 +63,10 @@ module Gitlab import_stage: self.class.name ) end + + def import_settings(project) + Gitlab::GithubImport::Settings.new(project) + end end end end -- cgit v1.2.3