Commit 6b9b5160 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '39884-fix-pipeline-transition-with-single-manual-action' into 'master'

Make sure all pipelines would go to pending once

Closes #39884

See merge request gitlab-org/gitlab-ce!15251
parents 8902bdec c00fde60
Pipeline #13914322 passed with stages
in 55 minutes and 16 seconds
......@@ -66,8 +66,8 @@ module Ci
state_machine :status, initial: :created do
event :enqueue do
transition created: :pending
transition [:success, :failed, :canceled, :skipped] => :running
transition [:created, :skipped] => :pending
transition [:success, :failed, :canceled] => :running
end
event :run do
......
---
title: Fix pipeline status transition for single manual job. This would also fix pipeline
duration becuse it is depending on status transition
merge_request: 15251
author:
type: fixed
......@@ -292,6 +292,30 @@ describe Ci::ProcessPipelineService, '#execute' do
end
end
context 'when there is only one manual action' do
before do
create_build('deploy', stage_idx: 0, when: 'manual', allow_failure: true)
process_pipeline
end
it 'skips the pipeline' do
expect(pipeline.reload).to be_skipped
end
context 'when the action was played' do
before do
play_manual_action('deploy')
end
it 'queues the action and pipeline' do
expect(all_builds_statuses).to eq(%w[pending])
expect(pipeline.reload).to be_pending
end
end
end
context 'when blocking manual actions are defined' do
before do
create_build('code:test', stage_idx: 0)
......
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