Class: Gitlab::Ci::Config::Entry::Rules::Rule

Inherits:
Gitlab::Config::Entry::Node show all
Includes:
Gitlab::Config::Entry::Attributable, Gitlab::Config::Entry::Configurable, Gitlab::Config::Entry::Validatable
Defined in:
lib/gitlab/ci/config/entry/rules/rule.rb,
lib/gitlab/ci/config/entry/rules/rule/exists.rb,
lib/gitlab/ci/config/entry/rules/rule/changes.rb

Overview

A rule is a condition that is evaluated before a job is executed. Until we find a better solution in gitlab.com/gitlab-org/gitlab/-/issues/436473, these two metadata parameters need to be passed to ‘Entry::Rules`:

  • ‘allowed_when`: a list of allowed values for the `when` keyword.

  • ‘allowed_keys`: a list of allowed keys for each rule.

Defined Under Namespace

Classes: Changes, Exists

Constant Summary

Constants inherited from Gitlab::Config::Entry::Node

Gitlab::Config::Entry::Node::InvalidError

Instance Attribute Summary

Attributes inherited from Gitlab::Config::Entry::Node

#config, #deprecation, #description, #key, #metadata, #parent

Instance Method Summary collapse

Methods included from Gitlab::Config::Entry::Configurable

#compose!, #entry_create!, #skip_config_hash_validation?

Methods included from Gitlab::Config::Entry::Validatable

#compose!, #errors, included, #validate, #validator

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

Instance Method Details

#defaultObject



79
# File 'lib/gitlab/ci/config/entry/rules/rule.rb', line 79

def default; end

#specifies_delay?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/gitlab/ci/config/entry/rules/rule.rb', line 75

def specifies_delay?
  self.when == 'delayed'
end

#valueObject



65
66
67
68
69
70
71
72
73
# File 'lib/gitlab/ci/config/entry/rules/rule.rb', line 65

def value
  config.merge(
    changes: (changes_value if changes_defined?),
    exists: (exists_value if exists_defined?),
    variables: (variables_value if variables_defined?),
    needs: (needs_value if needs_defined?),
    auto_cancel: (auto_cancel_value if auto_cancel_defined?)
  ).compact
end