Module: Gitlab::BitbucketServerImport::StageMethods
- Extended by:
- ActiveSupport::Concern
- Included in:
- Gitlab::BitbucketServerImport::Stage::FinishImportWorker, Gitlab::BitbucketServerImport::Stage::ImportLfsObjectsWorker, Gitlab::BitbucketServerImport::Stage::ImportNotesWorker, Gitlab::BitbucketServerImport::Stage::ImportPullRequestsWorker, Gitlab::BitbucketServerImport::Stage::ImportRepositoryWorker
- Defined in:
- app/workers/concerns/gitlab/bitbucket_server_import/stage_methods.rb
Instance Method Summary collapse
- #abort_on_failure ⇒ Object
- #find_project(id) ⇒ Object
-
#perform(project_id) ⇒ Object
project_id - The ID of the GitLab project to import the data into.
Instance Method Details
#abort_on_failure ⇒ Object
56 57 58 |
# File 'app/workers/concerns/gitlab/bitbucket_server_import/stage_methods.rb', line 56 def abort_on_failure false end |
#find_project(id) ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/workers/concerns/gitlab/bitbucket_server_import/stage_methods.rb', line 48 def find_project(id) # If the project has been marked as failed we want to bail out # automatically. # rubocop: disable CodeReuse/ActiveRecord Project.joins_import_state.where(import_state: { status: :started }).find_by_id(id) # rubocop: enable CodeReuse/ActiveRecord end |
#perform(project_id) ⇒ Object
project_id - The ID of the GitLab project to import the data into.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/workers/concerns/gitlab/bitbucket_server_import/stage_methods.rb', line 29 def perform(project_id) info(project_id, message: 'starting stage') return unless (project = find_project(project_id)) import(project) info(project_id, message: 'stage finished') rescue StandardError => e Gitlab::Import::ImportFailureService.track( project_id: project_id, exception: e, error_source: self.class.name, fail_import: abort_on_failure ) raise(e) end |