Class: Gitlab::Ci::Config::Entry::Bridge

Inherits:
Gitlab::Config::Entry::Node show all
Includes:
Processable
Defined in:
lib/gitlab/ci/config/entry/bridge.rb

Overview

Entry that represents a CI/CD Bridge job that is responsible for defining a downstream project trigger.

Constant Summary collapse

ALLOWED_WHEN =
%w[on_success on_failure always manual].freeze
ALLOWED_KEYS =
%i[trigger parallel].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

#compose!, #manual_action?, #name, #overwrite_entry, #root_variables_inheritance, #validate_against_warnings

Methods included from Gitlab::Config::Entry::Inheritable

#compose!

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

.matching?(name, config) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
61
62
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 58

def self.matching?(name, config)
  !name.to_s.start_with?('.') &&
    config.is_a?(Hash) &&
    (config.key?(:trigger) || config.key?(:needs))
end

.visible?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 64

def self.visible?
  true
end

Instance Method Details

#bridge_needsObject



79
80
81
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 79

def bridge_needs
  needs_value[:bridge] if needs_value
end

#ignored?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 83

def ignored?
  allow_failure.nil? ? manual_action? : allow_failure
end

#valueObject



68
69
70
71
72
73
74
75
76
77
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 68

def value
  super.merge(
    trigger: (trigger_value if trigger_defined?),
    needs: (needs_value if needs_defined?),
    ignore: ignored?,
    when: self.when,
    scheduling_type: needs_defined? && !bridge_needs ? :dag : :stage,
    parallel: has_parallel? ? parallel_value : nil
  ).compact
end