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 resource_group release secrets].freeze
- REQUIRED_BY_NEEDS =
%i[stage].freeze
Constants included from Processable
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, #description, #key, #metadata, #parent
Class Method Summary collapse
Instance Method Summary collapse
- #compose!(deps = nil) ⇒ Object
- #delayed? ⇒ Boolean
- #ignored? ⇒ Boolean
- #manual_action? ⇒ Boolean
- #value ⇒ Object
Methods included from Processable
#name, #overwrite_entry, #root_and_job_variables_value, #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
.matching?(name, config) ⇒ Boolean
125 126 127 128 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 125 def self.matching?(name, config) !name.to_s.start_with?('.') && config.is_a?(Hash) && config.key?(:script) end |
.visible? ⇒ Boolean
130 131 132 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 130 def self.visible? true end |
Instance Method Details
#compose!(deps = nil) ⇒ Object
134 135 136 137 138 139 140 141 142 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 134 def compose!(deps = nil) super do if type_defined? && !stage_defined? @entries[:stage] = @entries[:type] end @entries.delete(:type) end end |
#delayed? ⇒ Boolean
148 149 150 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 148 def delayed? self.when == 'delayed' end |
#ignored? ⇒ Boolean
152 153 154 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 152 def ignored? allow_failure.nil? ? manual_action? : allow_failure end |
#manual_action? ⇒ Boolean
144 145 146 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 144 def manual_action? self.when == 'manual' end |
#value ⇒ Object
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 182 |
# File 'lib/gitlab/ci/config/entry/job.rb', line 156 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?, needs: needs_defined? ? needs_value : nil, resource_group: resource_group, scheduling_type: needs_defined? ? :dag : :stage ).compact end |