Files
gitlabhq/lib/ci/status.rb
T
Kamil TrzcińskiandRémy Coutable bdbe892ea2 Merge branch 'fix/ci-first-job-allow-failure' into 'master'
Fix CI builds scheduler when first build in stage is allowed to fail

This fixes an edge case in CI builds scheduler when first build in stage was marked as allowed to fail.

Closes #3192

See merge request !2869
2016-02-18 16:18:45 +01:00

20 lines
448 B
Ruby

module Ci
class Status
def self.get_status(statuses)
if statuses.none?
'skipped'
elsif statuses.all? { |status| status.success? || status.ignored? }
'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