diff --git a/app/services/ci/retry_build_service.rb b/app/services/ci/retry_build_service.rb index ed4694237f6..a8464cd9922 100644 --- a/app/services/ci/retry_build_service.rb +++ b/app/services/ci/retry_build_service.rb @@ -7,7 +7,7 @@ module Ci new_build.enqueue! MergeRequests::AddTodoWhenBuildFailsService - .new(build.project, current_user) + .new(project, current_user) .close(new_build) end end diff --git a/app/services/ci/retry_pipeline_service.rb b/app/services/ci/retry_pipeline_service.rb index 8a1a9191478..808f29adea2 100644 --- a/app/services/ci/retry_pipeline_service.rb +++ b/app/services/ci/retry_pipeline_service.rb @@ -12,6 +12,10 @@ module Ci .reprocess(build) end + MergeRequests::AddTodoWhenBuildFailsService + .new(project, current_user) + .close_all(pipeline) + pipeline.process! end diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb index 81019e3db1c..c0af8b8450a 100644 --- a/spec/services/ci/retry_pipeline_service_spec.rb +++ b/spec/services/ci/retry_pipeline_service_spec.rb @@ -132,6 +132,19 @@ describe Ci::RetryPipelineService, '#execute', :services do end end end + + it 'closes all todos about failed jobs for pipeline' do + expect(MergeRequests::AddTodoWhenBuildFailsService) + .to receive_message_chain(:new, :close_all) + + service.execute(pipeline) + end + + it 'reprocesses the pipeline' do + expect(pipeline).to receive(:process!) + + service.execute(pipeline) + end end context 'when user is not allowed to retry pipeline' do