Commit c7e2b1a8 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'retry-cancelled-pipelines' into 'master'

Make cancelled pipelines being able to retry

## What does this MR do?

Make cancelled pipelines being able to retry

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
  - [x] Added for this feature/bug

## What are the relevant issue numbers?

Closes #23326

See merge request !6927
parents eb541b4f b3d401ad
......@@ -17,6 +17,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Fix centering of custom header logos (Ashley Dumaine)
- ExpireBuildArtifactsWorker query builds table without ordering enqueuing one job per build to cleanup
- Add an example for testing a phoenix application with Gitlab CI in the docs (Manthan Mallikarjun)
- Cancelled pipelines could be retried. !6927
- Updating verbiage on git basics to be more intuitive
- Clarify documentation for Runners API (Gennady Trafimenkov)
- The instrumentation for Banzai::Renderer has been restored
......
......@@ -154,7 +154,7 @@ module Ci
def retryable?
builds.latest.any? do |build|
build.failed? && build.retryable?
(build.failed? || build.canceled?) && build.retryable?
end
end
......
......@@ -88,24 +88,38 @@ describe Ci::Pipeline, models: true do
context 'no failed builds' do
before do
FactoryGirl.create :ci_build, name: "rspec", pipeline: pipeline, status: 'success'
create_build('rspec', 'success')
end
it 'be not retryable' do
it 'is not retryable' do
is_expected.to be_falsey
end
context 'one canceled job' do
before do
create_build('rubocop', 'canceled')
end
it 'is retryable' do
is_expected.to be_truthy
end
end
end
context 'with failed builds' do
before do
FactoryGirl.create :ci_build, name: "rspec", pipeline: pipeline, status: 'running'
FactoryGirl.create :ci_build, name: "rubocop", pipeline: pipeline, status: 'failed'
create_build('rspec', 'running')
create_build('rubocop', 'failed')
end
it 'be retryable' do
it 'is retryable' do
is_expected.to be_truthy
end
end
def create_build(name, status)
create(:ci_build, name: name, status: status, pipeline: pipeline)
end
end
describe '#stages' 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