Class: Gitlab::Ci::Config::Entry::Job
- Inherits:
-
Gitlab::Config::Entry::Node
- Object
- Gitlab::Config::Entry::Node
- Gitlab::Ci::Config::Entry::Job
- Includes:
- Processable
- Defined in:
- lib/gitlab/ci/config/entry/job.rb
Overview
Entry that represents a concrete CI/CD job.
Constant Summary collapse
- ALLOWED_WHEN =
%w[on_success on_failure always manual delayed].freeze
- ALLOWED_KEYS =
%i[tags script image services start_in artifacts cache dependencies before_script after_script hooks coverage retry parallel timeout inputs release id_tokens publish pages manual_confirmation run].freeze
- PUBLIC_DIR =
'public'
Constants included from Processable
Processable::MAX_NESTING_LEVEL, Processable::PROCESSABLE_ALLOWED_KEYS
Constants included from Gitlab::Config::Entry::Inheritable
Gitlab::Config::Entry::Inheritable::InheritError
Constants inherited from Gitlab::Config::Entry::Node
Gitlab::Config::Entry::Node::InvalidError
Instance Attribute Summary
Attributes inherited from Gitlab::Config::Entry::Node
#config, #default, #deprecation, #description, #key, #metadata, #parent
Class Method Summary collapse
Instance Method Summary collapse
- #artifacts_with_pages_publish_path ⇒ Object
- #delayed? ⇒ Boolean
- #ignored? ⇒ Boolean
- #pages_job? ⇒ Boolean
- #parsed_timeout ⇒ Object
- #value ⇒ Object
Methods included from Processable
#compose!, #manual_action?, #name, #overwrite_entry, #root_variables_inheritance, #validate_against_warnings
Methods included from Gitlab::Config::Entry::Inheritable
Methods included from Gitlab::Config::Entry::Configurable
#compose!, #entry_create!, #skip_config_hash_validation?
Methods inherited from Gitlab::Config::Entry::Node
#[], #add_warning, #ancestors, #array?, aspects, #compose!, default, #descendants, #errors, #hash?, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #string?, #valid?, #warnings, with_aspect
Constructor Details
This class inherits a constructor from Gitlab::Config::Entry::Node
Class Method Details
.allowed_keys ⇒ Object
249 250 251 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 249 def self.allowed_keys ALLOWED_KEYS end |
.matching?(name, config) ⇒ Boolean
178 179 180 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 178 def self.matching?(name, config) !name.to_s.start_with?('.') && config.is_a?(Hash) && (config.key?(:script) || config.key?(:run)) end |
.visible? ⇒ Boolean
182 183 184 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 182 def self.visible? true end |
Instance Method Details
#artifacts_with_pages_publish_path ⇒ Object
238 239 240 241 242 243 244 245 246 247 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 238 def artifacts_with_pages_publish_path return artifacts_value unless pages_job? artifacts = artifacts_value || {} artifacts[:paths] ||= [] return artifacts if artifacts[:paths].include?(pages_publish_path) artifacts.merge(paths: artifacts[:paths] + [pages_publish_path]) end |
#delayed? ⇒ Boolean
186 187 188 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 186 def delayed? self.when == 'delayed' end |
#ignored? ⇒ Boolean
228 229 230 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 228 def ignored? allow_failure_defined? ? static_allow_failure : manual_action? end |
#pages_job? ⇒ Boolean
232 233 234 235 236 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 232 def pages_job? return true if config[:pages].present? name == :pages && config[:pages] != false # legacy behavior, overridable with `pages: false` end |
#parsed_timeout ⇒ Object
222 223 224 225 226 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 222 def parsed_timeout return unless has_timeout? ChronicDuration.parse(timeout.to_s) end |
#value ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 190 def value super.merge( before_script: before_script_value, script: script_value, image: image_value, services: services_value, cache: cache_value, tags: , when: self.when, start_in: self.start_in, dependencies: dependencies, coverage: coverage_defined? ? coverage_value : nil, retry: retry_defined? ? retry_value : nil, parallel: has_parallel? ? parallel_value : nil, timeout: parsed_timeout, artifacts: artifacts_with_pages_publish_path, release: release_value, after_script: after_script_value, hooks: hooks_value, ignore: ignored?, allow_failure_criteria: allow_failure_criteria, needs: needs_defined? ? needs_value : nil, scheduling_type: needs_defined? ? :dag : :stage, id_tokens: id_tokens_value, publish: publish, pages: pages, manual_confirmation: self.manual_confirmation, run: run, inputs: inputs_value ).compact end |