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

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
parents 40663fb9 d476d089
...@@ -184,7 +184,7 @@ module Ci ...@@ -184,7 +184,7 @@ module Ci
end end
def playable? def playable?
action? && (manual? || complete?) action? && (manual? || retryable?)
end end
def action? def action?
......
---
title: Do not allow to trigger manual actions that were skipped
merge_request: 18985
author:
type: fixed
...@@ -1270,6 +1270,46 @@ describe Ci::Build do ...@@ -1270,6 +1270,46 @@ describe Ci::Build do
end end
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 'project settings' do
describe '#allow_git_fetch' do describe '#allow_git_fetch' do
it 'return project allow_git_fetch configuration' do it 'return project allow_git_fetch configuration' 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