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

70 lines
2.3 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',
2019-12-26 22:10:19 +05:30
unmet_prerequisites: 'unmet prerequisites',
scheduler_failure: 'scheduler failure',
2020-03-13 15:44:24 +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',
2020-10-24 23:57:45 +05:30
downstream_pipeline_creation_failed: 'downstream pipeline can not be created',
2020-11-24 15:15:51 +05:30
secrets_provider_not_found: 'secrets provider can not be found',
reached_max_descendant_pipelines_depth: 'reached maximum depth of child pipelines'
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
2020-05-24 23:13:21 +05:30
Gitlab::Ci::Status::Build::Failed.prepend_if_ee('::EE::Gitlab::Ci::Status::Build::Failed')