summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2017-03-21 10:51:51 +0000
committerLin Jen-Shin <godfat@godfat.org>2017-03-21 22:31:17 +0800
commitc760463f62260ad19ec0de3013e90a1f48c3666b (patch)
tree797bee1aa8631cea4d5da70435d05054e7c5a73e
parent9ac42fa33f3ce7dd0ab63a33d35a872eca8f1474 (diff)
downloadgitlab-ce-c760463f62260ad19ec0de3013e90a1f48c3666b.tar.gz
Merge branch 'fix/gb/pipeline-intermittent-running-status' into 'master'
Fix pipeline status for transition between stages Closes #29699 See merge request !10094
-rw-r--r--app/models/concerns/has_status.rb1
-rw-r--r--spec/models/concerns/has_status_spec.rb18
2 files changed, 19 insertions, 0 deletions
diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb
index 5101cc7e687..0a1a65da05a 100644
--- a/app/models/concerns/has_status.rb
+++ b/app/models/concerns/has_status.rb
@@ -31,6 +31,7 @@ module HasStatus
WHEN (#{builds})=(#{created})+(#{skipped})+(#{pending}) THEN 'pending'
WHEN (#{running})+(#{pending})>0 THEN 'running'
WHEN (#{manual})>0 THEN 'manual'
+ WHEN (#{created})>0 THEN 'running'
ELSE 'failed'
END)"
end
diff --git a/spec/models/concerns/has_status_spec.rb b/spec/models/concerns/has_status_spec.rb
index f134da441c2..82abad0e2f6 100644
--- a/spec/models/concerns/has_status_spec.rb
+++ b/spec/models/concerns/has_status_spec.rb
@@ -110,6 +110,24 @@ describe HasStatus do
it { is_expected.to eq 'running' }
end
+ context 'when one status finished and second is still created' do
+ let!(:statuses) do
+ [create(type, status: :success), create(type, status: :created)]
+ end
+
+ it { is_expected.to eq 'running' }
+ end
+
+ context 'when there is a manual status before created status' do
+ let!(:statuses) do
+ [create(type, status: :success),
+ create(type, status: :manual, allow_failure: false),
+ create(type, status: :created)]
+ end
+
+ it { is_expected.to eq 'manual' }
+ end
+
context 'when one status is a blocking manual action' do
let!(:statuses) do
[create(type, status: :failed),