Commit 20de391b authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'fix-runner-eternal-loop-when-update-job-result' into 'master'

Fix runner eternal loop when update job result

Closes #56518

See merge request gitlab-org/gitlab-ce!24481
parents 75ead9a4 91c1dc57
...@@ -224,8 +224,15 @@ module Ci ...@@ -224,8 +224,15 @@ module Ci
before_transition any => [:failed] do |build| before_transition any => [:failed] do |build|
next unless build.project next unless build.project
next unless build.deployment
build.deployment&.drop begin
build.deployment.drop!
rescue => e
Gitlab::Sentry.track_exception(e, extra: { build_id: build.id })
end
true
end end
after_transition any => [:failed] do |build| after_transition any => [:failed] do |build|
......
---
title: Fix runner eternal loop when update job result
merge_request: 24481
author:
type: fixed
...@@ -3028,6 +3028,24 @@ describe Ci::Build do ...@@ -3028,6 +3028,24 @@ describe Ci::Build do
subject.drop! subject.drop!
end end
end end
context 'when associated deployment failed to update its status' do
let(:build) { create(:ci_build, :running, pipeline: pipeline) }
let!(:deployment) { create(:deployment, deployable: build) }
before do
allow_any_instance_of(Deployment)
.to receive(:drop!).and_raise('Unexpected error')
end
it 'can drop the build' do
expect(Gitlab::Sentry).to receive(:track_exception)
expect { build.drop! }.not_to raise_error
expect(build).to be_failed
end
end
end end
describe '.matches_tag_ids' do describe '.matches_tag_ids' do
......
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