blob: c4e0baa06036f84901af5c4c8e1e57ca66cc0603 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
module Ci
class BuildPresenter < CommitStatusPresenter
def erased_by_user?
# Build can be erased through API, therefore it does not have
# `erased_by` user assigned in that case.
erased? && erased_by
end
def erased_by_name
erased_by.name if erased_by_user?
end
def status_title
if auto_canceled?
"Job is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}"
else
tooltip_for_badge
end
end
def trigger_variables
return [] unless trigger_request
@trigger_variables ||=
if pipeline.variables.any?
pipeline.variables.map(&:to_runner_variable)
else
trigger_request.user_variables
end
end
def tooltip_message
"#{subject.name} - #{detailed_status.status_tooltip}"
end
def config_artifacts
list = []
options.dig(:artifacts).try do |artifacts|
list << config_artifacts_reports(artifacts.delete(:reports)) if artifacts.dig(:reports)
list << config_artifacts_archive(artifacts) if artifacts.dig(:paths)
end
list.flatten
end
private
def tooltip_for_badge
detailed_status.badge_tooltip.capitalize
end
def detailed_status
@detailed_status ||= subject.detailed_status(user)
end
def config_artifacts_archive(artifacts)
artifacts.merge(type: :archive, format: :zip)
end
def config_artifacts_reports(reports)
list = []
list << config_artifacts_reports_junit(reports.dig(:junit)) if reports.dig(:junit)
list
end
def config_artifacts_reports_junit(junit)
{ name: 'junit.xml', paths: junit, type: :junit, format: :gzip }
end
end
end
|