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_KEYS =
%i[trigger].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

Methods included from Processable

#compose!, #name, #overwrite_entry, #root_and_job_variables_value, #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, 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)

50
51
52
53
54
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 50

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)

56
57
58
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 56

def self.visible?
  true
end

Instance Method Details

#bridge_needsObject


70
71
72
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 70

def bridge_needs
  needs_value[:bridge] if needs_value
end

#valueObject


60
61
62
63
64
65
66
67
68
# File 'lib/gitlab/ci/config/entry/bridge.rb', line 60

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