diff options
| author | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2015-11-11 13:07:02 +0100 |
|---|---|---|
| committer | Zeger-Jan van de Weg <mail@zjvandeweg.nl> | 2015-11-11 13:07:02 +0100 |
| commit | 7e4a7d9ecc02db06c568a0de47e096edbdc1224b (patch) | |
| tree | 701af1b1789f17950a22a19df4cf8f69d3beb173 /lib/ci/status.rb | |
| parent | 3f08e4b186bd02b37f34ccf1bc641a95f9d865ce (diff) | |
| parent | dfa09789061bbd3891c17ebbcc23f7bd6b95336c (diff) | |
| download | gitlab-ce-7e4a7d9ecc02db06c568a0de47e096edbdc1224b.tar.gz | |
Merge branch 'master' into copying-file-seen-as-licence
Diffstat (limited to 'lib/ci/status.rb')
| -rw-r--r-- | lib/ci/status.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/ci/status.rb b/lib/ci/status.rb new file mode 100644 index 00000000000..c02b3b8f3e4 --- /dev/null +++ b/lib/ci/status.rb @@ -0,0 +1,21 @@ +module Ci + class Status + def self.get_status(statuses) + statuses.reject! { |status| status.try(&:allow_failure?) } + + if statuses.none? + 'skipped' + elsif statuses.all?(&:success?) + 'success' + elsif statuses.all?(&:pending?) + 'pending' + elsif statuses.any?(&:running?) || statuses.any?(&:pending?) + 'running' + elsif statuses.all?(&:canceled?) + 'canceled' + else + 'failed' + end + end + end +end |
