diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-12 12:45:00 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-01-12 12:45:00 +0100 |
commit | 1d01ffb782a1bf44d5826666590408b24fba2332 (patch) | |
tree | 33b142611d70b56e8e8170275948913d1c39e955 /lib | |
parent | 9f1279184b85927a12b93df00896c57b12373a9a (diff) | |
download | gitlab-ce-1d01ffb782a1bf44d5826666590408b24fba2332.tar.gz |
Make it possible to combine extended CI/CD statuses
This commit also makes it possible to configure exclusive groups.
There can be only one detailed status matched within an exclusive group,
which is important from the performance perspective.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/status/factory.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab/ci/status/factory.rb b/lib/gitlab/ci/status/factory.rb index ae9ef895df4..71c54aebcc3 100644 --- a/lib/gitlab/ci/status/factory.rb +++ b/lib/gitlab/ci/status/factory.rb @@ -8,10 +8,12 @@ module Gitlab end def fabricate! - if extended_status - extended_status.new(core_status) - else + if extended_statuses.none? core_status + else + extended_statuses.inject(core_status) do |status, extended| + extended.new(status) + end end end @@ -36,10 +38,14 @@ module Gitlab .extend(self.class.common_helpers) end - def extended_status - @extended ||= self.class.extended_statuses.find do |status| - status.matches?(@subject, @user) + def extended_statuses + return @extended_statuses if defined?(@extended_statuses) + + groups = self.class.extended_statuses.map do |group| + Array(group).find { |status| status.matches?(@subject, @user) } end + + @extended_statuses = groups.flatten.compact end end end |