42ca9c6f0d
Introduces a new status for builds between :created and :pending that will be used when builds require one or more prerequisite actions to be completed before being picked up by a runner (such as creating Kubernetes resources before deploying). The existing :created > :pending transition is unchanged, so only builds that require preparation will use the :preparing status.
51 lines
1.1 KiB
Ruby
51 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module Badge
|
|
module Pipeline
|
|
##
|
|
# Class that represents a pipeline badge template.
|
|
#
|
|
# Template object will be passed to badge.svg.erb template.
|
|
#
|
|
class Template < Badge::Template
|
|
STATUS_RENAME = { 'success' => 'passed' }.freeze
|
|
STATUS_COLOR = {
|
|
success: '#4c1',
|
|
failed: '#e05d44',
|
|
running: '#dfb317',
|
|
pending: '#dfb317',
|
|
preparing: '#dfb317',
|
|
canceled: '#9f9f9f',
|
|
skipped: '#9f9f9f',
|
|
unknown: '#9f9f9f'
|
|
}.freeze
|
|
|
|
def initialize(badge)
|
|
@entity = badge.entity
|
|
@status = badge.status
|
|
end
|
|
|
|
def key_text
|
|
@entity.to_s
|
|
end
|
|
|
|
def value_text
|
|
STATUS_RENAME[@status.to_s] || @status.to_s
|
|
end
|
|
|
|
def key_width
|
|
62
|
|
end
|
|
|
|
def value_width
|
|
54
|
|
end
|
|
|
|
def value_color
|
|
STATUS_COLOR[@status.to_sym] || STATUS_COLOR[:unknown]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|