Commit 6367fa99 authored by Fabio Pitino's avatar Fabio Pitino

Handle exception in PipelineBridgeStatusService

parent 67ada8d4
...@@ -5,7 +5,13 @@ module Ci ...@@ -5,7 +5,13 @@ module Ci
def execute(pipeline) def execute(pipeline)
return unless pipeline.bridge_triggered? return unless pipeline.bridge_triggered?
begin
pipeline.source_bridge.inherit_status_from_downstream!(pipeline) pipeline.source_bridge.inherit_status_from_downstream!(pipeline)
rescue StateMachines::InvalidTransition => e
Gitlab::ErrorTracking.track_exception(e,
bridge_id: pipeline.source_bridge.id,
downstream_pipeline_id: pipeline.id)
end
end end
end end
end end
......
...@@ -22,6 +22,24 @@ describe Ci::PipelineBridgeStatusService do ...@@ -22,6 +22,24 @@ describe Ci::PipelineBridgeStatusService do
subject subject
end end
context 'when bridge job status raises state machine errors' do
before do
pipeline.drop!
bridge.drop!
end
it 'tracks the exception' do
expect(Gitlab::ErrorTracking)
.to receive(:track_exception)
.with(
instance_of(StateMachines::InvalidTransition),
bridge_id: bridge.id,
downstream_pipeline_id: pipeline.id)
subject
end
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment