Skip to content
Snippets Groups Projects
Commit d16eed3b authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Fix reprocessing skipped jobs when retrying pipeline

parent 5a84b5fd
No related branches found
No related tags found
1 merge request!9436Fix reprocessing skipped jobs when retrying pipeline
Pipeline #
Loading
@@ -8,6 +8,8 @@ module Ci
Loading
@@ -8,6 +8,8 @@ module Ci
pipeline.builds.failed_or_canceled.find_each do |build| pipeline.builds.failed_or_canceled.find_each do |build|
next unless build.retryable? next unless build.retryable?
   
pipeline.mark_as_processable_after_stage(build.stage_idx)
Ci::RetryBuildService.new(project, current_user) Ci::RetryBuildService.new(project, current_user)
.reprocess(build) .reprocess(build)
end end
Loading
Loading
Loading
@@ -69,6 +69,25 @@ describe Ci::RetryPipelineService, '#execute', :services do
Loading
@@ -69,6 +69,25 @@ describe Ci::RetryPipelineService, '#execute', :services do
end end
end end
   
context 'when the last stage was skipepd' do
before do
create_build('build 1', :success, 0)
create_build('test 2', :failed, 1)
create_build('report 3', :skipped, 2)
create_build('report 4', :skipped, 2)
end
it 'retries builds only in the first stage' do
service.execute(pipeline)
expect(build('build 1')).to be_success
expect(build('test 2')).to be_pending
expect(build('report 3')).to be_created
expect(build('report 4')).to be_created
expect(pipeline.reload).to be_running
end
end
context 'when pipeline contains manual actions' do context 'when pipeline contains manual actions' do
context 'when there is a canceled manual action in first stage' do context 'when there is a canceled manual action in first stage' do
before do before do
Loading
@@ -90,14 +109,16 @@ describe Ci::RetryPipelineService, '#execute', :services do
Loading
@@ -90,14 +109,16 @@ describe Ci::RetryPipelineService, '#execute', :services do
context 'when there is a skipped manual action in last stage' do context 'when there is a skipped manual action in last stage' do
before do before do
create_build('rspec 1', :canceled, 0) create_build('rspec 1', :canceled, 0)
create_build('rspec 2', :skipped, 0, :manual)
create_build('staging', :skipped, 1, :manual) create_build('staging', :skipped, 1, :manual)
end end
   
it 'retries canceled job and skips manual action' do it 'retries canceled job and reprocesses manual actions' do
service.execute(pipeline) service.execute(pipeline)
   
expect(build('rspec 1')).to be_pending expect(build('rspec 1')).to be_pending
expect(build('staging')).to be_skipped expect(build('rspec 2')).to be_skipped
expect(build('staging')).to be_created
expect(pipeline.reload).to be_running expect(pipeline.reload).to be_running
end end
end end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment