diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-20 12:40:42 +0300 |
commit | ee664acb356f8123f4f6b00b73c1e1cf0866c7fb (patch) | |
tree | f8479f94a28f66654c6a4f6fb99bad6b4e86a40e /app/workers/concerns/gitlab | |
parent | 62f7d5c5b69180e82ae8196b7b429eeffc8e7b4f (diff) |
Add latest changes from gitlab-org/gitlab@15-5-stable-eev15.5.0-rc42
Diffstat (limited to 'app/workers/concerns/gitlab')
-rw-r--r-- | app/workers/concerns/gitlab/github_import/object_importer.rb | 34 | ||||
-rw-r--r-- | app/workers/concerns/gitlab/github_import/stage_methods.rb | 4 |
2 files changed, 24 insertions, 14 deletions
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 |