Commit 64ebe8a7 authored by Fabio Pitino's avatar Fabio Pitino

Merge branch '243857-matrix-job-status-allow-failure' into 'master'

Correct status indicator for job groups when failure is allowed

See merge request gitlab-org/gitlab!51478
parents 5b598ac9 473a660f
......@@ -24,9 +24,22 @@ module Ci
def status
strong_memoize(:status) do
status_struct.status
end
end
def success?
status.to_s == 'success'
end
def has_warnings?
status_struct.warnings?
end
def status_struct
strong_memoize(:status_struct) do
Gitlab::Ci::Status::Composite
.new(@jobs)
.status
end
end
......
---
title: Correct status indicator for jobs groups when failure is allowed
merge_request: 51478
author: Sune Keller (sirlatrom)
type: fixed
......@@ -8,6 +8,10 @@ module Gitlab
def self.common_helpers
Status::Group::Common
end
def self.extended_statuses
[[Status::SuccessWarning]]
end
end
end
end
......
......@@ -12,4 +12,9 @@ RSpec.describe Gitlab::Ci::Status::Group::Factory do
expect(described_class.common_helpers)
.to eq Gitlab::Ci::Status::Group::Common
end
it 'exposes extended statuses' do
expect(described_class.extended_statuses)
.to eq([[Gitlab::Ci::Status::SuccessWarning]])
end
end
......@@ -54,6 +54,18 @@ RSpec.describe Ci::Group do
.to be_a(Gitlab::Ci::Status::Failed)
end
end
context 'when one of the commit statuses in the group is allowed to fail' do
let(:jobs) do
[create(:ci_build, :failed, :allowed_to_fail),
create(:ci_build, :success)]
end
it 'fabricates a new detailed status object' do
expect(subject.detailed_status(double(:user)))
.to be_a(Gitlab::Ci::Status::SuccessWarning)
end
end
end
describe '.fabricate' 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