diff options
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/48320-cancel-a-created-job.yml | 5 | ||||
-rw-r--r-- | spec/models/ci/build_spec.rb | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 9292929be98..3c69677baf0 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -226,7 +226,7 @@ module Ci end def cancelable? - active? + active? || created? end def retryable? diff --git a/changelogs/unreleased/48320-cancel-a-created-job.yml b/changelogs/unreleased/48320-cancel-a-created-job.yml new file mode 100644 index 00000000000..3e7a9e9ae52 --- /dev/null +++ b/changelogs/unreleased/48320-cancel-a-created-job.yml @@ -0,0 +1,5 @@ +--- +title: Allows to cancel a Created job +merge_request: 20635 +author: Jacopo Beschi @jacopo-beschi +type: added diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 32b8755ee9a..42b627b6823 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1103,6 +1103,12 @@ describe Ci::Build do it { is_expected.to be_cancelable } end + + context 'when build is created' do + let(:build) { create(:ci_build, :created) } + + it { is_expected.to be_cancelable } + end end context 'when build is not cancelable' do |