2018-05-09 12:01:36 +05:30
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Status
|
|
|
|
module Build
|
|
|
|
class Failed < Status::Extended
|
|
|
|
REASONS = {
|
2018-11-18 11:00:15 +05:30
|
|
|
unknown_failure: 'unknown failure',
|
|
|
|
script_failure: 'script failure',
|
|
|
|
api_failure: 'API failure',
|
|
|
|
stuck_or_timeout_failure: 'stuck or timeout failure',
|
|
|
|
runner_system_failure: 'runner system failure',
|
|
|
|
missing_dependency_failure: 'missing dependency failure',
|
2018-12-05 23:21:45 +05:30
|
|
|
runner_unsupported: 'unsupported runner',
|
|
|
|
stale_schedule: 'stale schedule'
|
2018-05-09 12:01:36 +05:30
|
|
|
}.freeze
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
private_constant :REASONS
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def status_tooltip
|
|
|
|
base_message
|
|
|
|
end
|
|
|
|
|
|
|
|
def badge_tooltip
|
|
|
|
base_message
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.matches?(build, user)
|
|
|
|
build.failed?
|
|
|
|
end
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
def self.reasons
|
|
|
|
REASONS
|
|
|
|
end
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
private
|
|
|
|
|
|
|
|
def base_message
|
|
|
|
"#{s_('CiStatusLabel|failed')} #{description}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
2018-11-18 11:00:15 +05:30
|
|
|
"- (#{failure_reason_message})"
|
|
|
|
end
|
|
|
|
|
|
|
|
def failure_reason_message
|
2018-11-20 20:47:30 +05:30
|
|
|
self.class.reasons.fetch(subject.failure_reason.to_sym)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|