Commit 85e2e406 authored by Fabio Pitino's avatar Fabio Pitino

Merge branch '213456-fix-bridge-retry-after-retry' into 'master'

Fix non-retrying bridges after retried builds in CI pipelines

See merge request gitlab-org/gitlab!39989
parents c44d5310 aa2a7ce3
......@@ -539,12 +539,6 @@ module Ci
end
# rubocop: enable CodeReuse/ServiceClass
def mark_as_processable_after_stage(stage_idx)
builds.skipped.after_stage(stage_idx).find_each do |build|
Gitlab::OptimisticLocking.retry_lock(build, &:process)
end
end
def lazy_ref_commit
return unless ::Gitlab::Ci::Features.pipeline_latest?
......
......@@ -12,7 +12,7 @@ module Ci
build.ensure_scheduling_type!
reprocess!(build).tap do |new_build|
build.pipeline.mark_as_processable_after_stage(build.stage_idx)
mark_subsequent_stages_as_processable(build)
Gitlab::OptimisticLocking.retry_lock(new_build, &:enqueue)
......@@ -60,5 +60,11 @@ module Ci
end
build
end
def mark_subsequent_stages_as_processable(build)
build.pipeline.processables.skipped.after_stage(build.stage_idx).find_each do |processable|
Gitlab::OptimisticLocking.retry_lock(processable, &:process)
end
end
end
end
---
title: Fix non-retrying bridges after retried builds in CI pipelines
merge_request: 39989
author:
type: fixed
......@@ -53,5 +53,10 @@ FactoryBot.define do
finished
status { 'failed' }
end
trait :skipped do
started
status { 'skipped' }
end
end
end
......@@ -181,17 +181,24 @@ RSpec.describe Ci::RetryBuildService do
service.execute(build)
end
context 'when there are subsequent builds that are skipped' do
context 'when there are subsequent processables that are skipped' do
let!(:subsequent_build) do
create(:ci_build, :skipped, stage_idx: 2,
pipeline: pipeline,
stage: 'deploy')
end
it 'resumes pipeline processing in a subsequent stage' do
let!(:subsequent_bridge) do
create(:ci_bridge, :skipped, stage_idx: 2,
pipeline: pipeline,
stage: 'deploy')
end
it 'resumes pipeline processing in the subsequent stage' do
service.execute(build)
expect(subsequent_build.reload).to be_created
expect(subsequent_bridge.reload).to be_created
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