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 resource_group environment
interruptible].freeze
- MAX_NESTING_LEVEL =
10
Gitlab::Config::Entry::Inheritable::InheritError
Instance Method Summary
collapse
#entry_create!, #skip_config_hash_validation?
Instance Method Details
#compose!(deps = nil) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 87
def compose!(deps = nil)
has_workflow_rules = deps&.workflow_entry&.has_rules?
super do
if has_rules? || has_workflow_rules
@entries.delete(:only) unless only_defined? @entries.delete(:except) unless except_defined? end
yield if block_given?
end
validate_against_warnings unless has_workflow_rules
end
|
#manual_action? ⇒ Boolean
151
152
153
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 151
def manual_action?
self.when == 'manual'
end
|
#name ⇒ Object
121
122
123
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 121
def name
metadata[:name]
end
|
#overwrite_entry(deps, key, current_entry) ⇒ Object
125
126
127
128
129
130
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 125
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_variables_inheritance ⇒ Object
147
148
149
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 147
def root_variables_inheritance
inherit_entry&.variables_entry&.value
end
|
#validate_against_warnings ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 109
def validate_against_warnings
return unless rules_value
last_rule = rules_value.last
if last_rule&.keys == [:when] && last_rule[:when] != 'never'
docs_url = 'read more: https://docs.gitlab.com/ee/ci/jobs/job_troubleshooting.html#job-may-allow-multiple-pipelines-to-run-for-a-single-action-warning'
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/gitlab/ci/config/entry/processable.rb', line 132
def value
{ name: name,
stage: stage_value,
extends: extends,
rules: rules_value,
job_variables: variables_entry.value_with_data,
root_variables_inheritance: root_variables_inheritance,
only: only_value,
except: except_value,
environment: environment_defined? ? environment_value : nil,
environment_name: environment_defined? ? environment_value[:name] : nil,
resource_group: resource_group,
interruptible: interruptible_defined? ? interruptible_value : nil }.compact
end
|