BigW Consortium Gitlab

Commit 81b1730d by Kamil Trzciński Committed by DJ Mountney

Merge branch 'fix/gb/pipeline-retry-only-latest-jobs' into 'master'

Do not retry jobs multiple times when retrying a pipeline Closes #30092 See merge request !10249
parent 87d66fa5
......@@ -7,14 +7,14 @@ module Ci
raise Gitlab::Access::AccessDeniedError
end
pipeline.builds.failed_or_canceled.find_each do |build|
pipeline.builds.latest.failed_or_canceled.find_each do |build|
next unless build.retryable?
Ci::RetryBuildService.new(project, current_user)
.reprocess(build)
end
pipeline.builds.skipped.find_each do |skipped|
pipeline.builds.latest.skipped.find_each do |skipped|
retry_optimistic_lock(skipped) { |build| build.process }
end
......
---
title: Fix bug that caused jobs that already had been retried to be retried again
when retrying a pipeline
merge_request: 10249
author:
......@@ -9,6 +9,19 @@ describe Ci::RetryPipelineService, '#execute', :services do
context 'when user has ability to modify pipeline' do
let(:user) { create(:admin) }
context 'when there are already retried jobs present' do
before do
create_build('rspec', :canceled, 0)
create_build('rspec', :failed, 0)
end
it 'does not retry jobs that has already been retried' do
expect(statuses.first).to be_retried
expect { service.execute(pipeline) }
.to change { CommitStatus.count }.by(1)
end
end
context 'when there are failed builds in the last stage' do
before do
create_build('rspec 1', :success, 0)
......
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