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',
|
2019-12-26 22:10:19 +05:30
|
|
|
unmet_prerequisites: 'unmet prerequisites',
|
|
|
|
scheduler_failure: 'scheduler failure',
|
2020-03-09 13:42:32 +05:30
|
|
|
data_integrity_failure: 'data integrity failure',
|
|
|
|
forward_deployment_failure: 'forward deployment failure',
|
|
|
|
invalid_bridge_trigger: 'downstream pipeline trigger definition is invalid',
|
|
|
|
downstream_bridge_project_not_found: 'downstream project could not be found',
|
|
|
|
insufficient_bridge_permissions: 'no permissions to trigger downstream pipeline',
|
|
|
|
bridge_pipeline_is_child_pipeline: 'creation of child pipeline not allowed from another child pipeline',
|
|
|
|
downstream_pipeline_creation_failed: 'downstream pipeline can not be created'
|
2018-05-09 12:01:36 +05:30
|
|
|
}.freeze
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
private_constant :REASONS
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
prepend_if_ee('::EE::Gitlab::Ci::Status::Build::Failed') # rubocop: disable Cop/InjectEnterpriseEditionModule
|
|
|
|
|
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
|