debian-mirror-gitlab/lib/gitlab/ci/status/build/failed.rb

58 lines
1.4 KiB
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
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',
2018-12-13 13:39:08 +05:30
stale_schedule: 'stale schedule',
job_execution_timeout: 'job execution timeout',
2019-07-07 11:18:12 +05:30
archived_failure: 'archived failure',
unmet_prerequisites: 'unmet prerequisites'
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