diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-13 14:01:17 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-12-13 14:01:17 +0100 |
commit | f4513d5c1981922e71a00b9e4b135605eb674c6f (patch) | |
tree | f3627ae77b20bc4f303d8520128f3c925fdd9d9b | |
parent | a9ec4ec07e64d5f823c30d9bcc4c4bb1be7f2d75 (diff) | |
download | gitlab-ce-f4513d5c1981922e71a00b9e4b135605eb674c6f.tar.gz |
Make it possible to retry build that was canceled
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | spec/models/build_spec.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 89b0cae25ed..e7cf606a7ae 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -135,7 +135,7 @@ module Ci def retryable? project.builds_enabled? && commands.present? && - (success? || failed?) + (success? || failed? || canceled?) end def retried? diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index 2b678355ee5..e9b4cac5fef 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -918,6 +918,14 @@ describe Ci::Build, models: true do it { is_expected.to be_retryable } end + + context 'when build is canceled' do + before do + build.cancel! + end + + it { is_expected.to be_retryable } + end end context 'when build is not retryable' do |