Merge branch 'fix/gb/not-allow-to-trigger-skipped-manual-actions' into 'master'

Do not allow to trigger manual actions that were skipped

Closes #42589

See merge request gitlab-org/gitlab-ce!18985
This commit is contained in:
Kamil Trzciński 2018-05-18 11:50:31 +00:00
commit e330b70946
3 changed files with 46 additions and 1 deletions

View file

@ -184,7 +184,7 @@ module Ci
end
def playable?
action? && (manual? || complete?)
action? && (manual? || retryable?)
end
def action?

View file

@ -0,0 +1,5 @@
---
title: Do not allow to trigger manual actions that were skipped
merge_request: 18985
author:
type: fixed

View file

@ -1270,6 +1270,46 @@ describe Ci::Build do
end
end
describe '#playable?' do
context 'when build is a manual action' do
context 'when build has been skipped' do
subject { build_stubbed(:ci_build, :manual, status: :skipped) }
it { is_expected.not_to be_playable }
end
context 'when build has been canceled' do
subject { build_stubbed(:ci_build, :manual, status: :canceled) }
it { is_expected.to be_playable }
end
context 'when build is successful' do
subject { build_stubbed(:ci_build, :manual, status: :success) }
it { is_expected.to be_playable }
end
context 'when build has failed' do
subject { build_stubbed(:ci_build, :manual, status: :failed) }
it { is_expected.to be_playable }
end
context 'when build is a manual untriggered action' do
subject { build_stubbed(:ci_build, :manual, status: :manual) }
it { is_expected.to be_playable }
end
end
context 'when build is not a manual action' do
subject { build_stubbed(:ci_build, :success) }
it { is_expected.not_to be_playable }
end
end
describe 'project settings' do
describe '#allow_git_fetch' do
it 'return project allow_git_fetch configuration' do