summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2016-03-17 15:51:11 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2016-03-17 15:51:11 +0000
commitf728e4b519bc153534dc9632aa37932e2ac24801 (patch)
treead34a55d73796efbadf9ea747aed7db0db9dd2e4
parent9392e1375cdd65fe4a0a53ee12691aed94e25138 (diff)
parent573c8d561f369e8ceac21787a66df42d214bbecf (diff)
downloadgitlab-ce-f728e4b519bc153534dc9632aa37932e2ac24801.tar.gz
Merge branch 'glalonde-triggerbuild' into 'master'
Adjusted behavior so canceled builds tagged as allowed to fail do not fail build ## What does this MR do? This diff changes the 'Allowed to fail' flag to also ignore canceled builds, whereas before, canceled builds could fail the suite even if they were marked as 'Allowed to fail' dupe of !3258 to force a build ## Are there points in the code the reviewer needs to double check? no ## Why was this MR needed? Unexpected behavior as a user ## What are the relevant issue numbers? ## Screenshots (if relevant) ![whatisgoingon](/uploads/fcd7c8f3d8454bc730d7fd41eff59b31/whatisgoingon.png) See merge request !3271
-rw-r--r--CHANGELOG1
-rw-r--r--app/models/commit_status.rb2
-rw-r--r--spec/lib/ci/status_spec.rb23
3 files changed, 25 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 72e91a1dac1..75659d47666 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -45,6 +45,7 @@ v 8.6.0 (unreleased)
- Create external users which are excluded of internal and private projects unless access was explicitly granted
- Continue parameters are checked to ensure redirection goes to the same instance
- User deletion is now done in the background so the request can not time out
+ - Canceled builds are now ignored in compound build status if marked as `allowed to fail`
v 8.5.7
- Bump Git version requirement to 2.7.3
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 3b1aa0f5c80..3377a85a55a 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -114,7 +114,7 @@ class CommitStatus < ActiveRecord::Base
end
def ignored?
- failed? && allow_failure?
+ allow_failure? && (failed? || canceled?)
end
def duration
diff --git a/spec/lib/ci/status_spec.rb b/spec/lib/ci/status_spec.rb
index 1539720bb8d..47f3df6e3ce 100644
--- a/spec/lib/ci/status_spec.rb
+++ b/spec/lib/ci/status_spec.rb
@@ -48,6 +48,29 @@ describe Ci::Status do
it { is_expected.to eq 'success' }
end
+ context 'success and canceled' do
+ let(:statuses) do
+ [create(type, status: :success), create(type, status: :canceled)]
+ end
+ it { is_expected.to eq 'failed' }
+ end
+
+ context 'all canceled' do
+ let(:statuses) do
+ [create(type, status: :canceled), create(type, status: :canceled)]
+ end
+ it { is_expected.to eq 'canceled' }
+ end
+
+ context 'success and canceled but allowed to fail' do
+ let(:statuses) do
+ [create(type, status: :success),
+ create(type, status: :canceled, allow_failure: true)]
+ end
+
+ it { is_expected.to eq 'success' }
+ end
+
context 'one finished and second running but allowed to fail' do
let(:statuses) do
[create(type, status: :success),