gitlab-org--gitlab-foss/lib/ci/status.rb
Grzegorz Bizon 8114786665 Fix builds scheduler when first build is allowed to fail
Before this fix when there was only one relevant, previous build and it
failed, but was allowed to fail, entire build had been marked as
skipped.

Closes #3192
2016-02-18 11:50:11 +01:00

19 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