summaryrefslogtreecommitdiff
path: root/app/services/ci/pipeline_bridge_status_service.rb
blob: e2e5dd386f21a491f75e1e139148ff731ed95389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module Ci
  class PipelineBridgeStatusService < ::BaseService
    def execute(pipeline)
      return unless pipeline.bridge_triggered?

      begin
        pipeline.source_bridge.inherit_status_from_downstream!(pipeline)
      rescue StateMachines::InvalidTransition => e
        Gitlab::ErrorTracking.track_exception(
          Ci::Bridge::InvalidTransitionError.new(e.message),
          bridge_id: pipeline.source_bridge.id,
          downstream_pipeline_id: pipeline.id)
      end
    end
  end
end

Ci::PipelineBridgeStatusService.prepend_if_ee('EE::Ci::PipelineBridgeStatusService')