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 type image services start_in artifacts cache dependencies before_script after_script environment coverage retry parallel interruptible timeout release].freeze
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
Methods included from Processable
#manual_action?, #name, #overwrite_entry, #root_variables_inheritance, #validate_against_warnings
Methods included from Gitlab::Config::Entry::Configurable
#entry_create!, #skip_config_hash_validation?
Methods inherited from Gitlab::Config::Entry::Node
#[], #add_warning, #ancestors, aspects, 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
187 188 189 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 187 def self.allowed_keys ALLOWED_KEYS end |
.matching?(name, config) ⇒ Boolean
129 130 131 132 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 129 def self.matching?(name, config) !name.to_s.start_with?('.') && config.is_a?(Hash) && config.key?(:script) end |
.visible? ⇒ Boolean
134 135 136 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 134 def self.visible? true end |
Instance Method Details
#compose!(deps = nil) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 138 def compose!(deps = nil) super do # The type keyword will be removed in 15.0: # https://gitlab.com/gitlab-org/gitlab/-/issues/346823 if type_defined? && !stage_defined? @entries[:stage] = @entries[:type] log_and_warn_deprecated_entry(@entries[:type]) end @entries.delete(:type) end end |
#delayed? ⇒ Boolean
151 152 153 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 151 def delayed? self.when == 'delayed' end |
#ignored? ⇒ Boolean
183 184 185 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 183 def ignored? allow_failure_defined? ? static_allow_failure : manual_action? end |
#value ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 155 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, environment: environment_defined? ? environment_value : nil, environment_name: environment_defined? ? environment_value[:name] : nil, coverage: coverage_defined? ? coverage_value : nil, retry: retry_defined? ? retry_value : nil, parallel: has_parallel? ? parallel_value : nil, interruptible: interruptible_defined? ? interruptible_value : nil, timeout: has_timeout? ? ChronicDuration.parse(timeout.to_s) : nil, artifacts: artifacts_value, release: release_value, after_script: after_script_value, ignore: ignored?, allow_failure_criteria: allow_failure_criteria, needs: needs_defined? ? needs_value : nil, scheduling_type: needs_defined? ? :dag : :stage ).compact end |