Module: Gitlab::Ci::Config::Entry::Processable
Overview
Entry that represents a CI/CD Processable (a job)
Constant Summary
collapse
- PROCESSABLE_ALLOWED_KEYS =
%i[extends stage only except rules variables
inherit allow_failure when needs].freeze
Gitlab::Config::Entry::Inheritable::InheritError
Instance Method Summary
collapse
#entry_create!, #skip_config_hash_validation?
Instance Method Details
#compose!(deps = nil) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 70
def compose!(deps = nil)
super do
has_workflow_rules = deps&.workflow_entry&.has_rules?
if has_rules? || has_workflow_rules
@entries.delete(:only) unless only_defined? @entries.delete(:except) unless except_defined? end
unless has_workflow_rules
validate_against_warnings
end
@root_variables_value = deps&.variables_value
yield if block_given?
end
end
|
#name ⇒ Object
110
111
112
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 110
def name
metadata[:name]
end
|
#overwrite_entry(deps, key, current_entry) ⇒ Object
114
115
116
117
118
119
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 114
def overwrite_entry(deps, key, current_entry)
return unless inherit_entry&.default_entry&.inherit?(key)
return unless deps.default_entry
deps.default_entry[key] unless current_entry.specified?
end
|
#root_and_job_variables_value ⇒ Object
131
132
133
134
135
136
137
138
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 131
def root_and_job_variables_value
root_variables = @root_variables_value.to_h root_variables = root_variables.select do |key, _|
inherit_entry&.variables_entry&.inherit?(key)
end
root_variables.merge(variables_value.to_h)
end
|
#validate_against_warnings ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 97
def validate_against_warnings
return unless rules_value
return unless Gitlab::Ci::Features.raise_job_rules_without_workflow_rules_warning?
last_rule = rules_value.last
if last_rule&.keys == [:when] && last_rule[:when] != 'never'
docs_url = 'read more: https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings'
add_warning("may allow multiple pipelines to run for a single action due to `rules:when` clause with no `workflow:rules` - #{docs_url}")
end
end
|
#value ⇒ Object
121
122
123
124
125
126
127
128
129
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 121
def value
{ name: name,
stage: stage_value,
extends: extends,
rules: rules_value,
variables: root_and_job_variables_value,
only: only_value,
except: except_value }.compact
end
|