Class: Gitlab::Ci::Config::Entry::Environment

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

Overview

Entry that represents an environment.

Constant Summary collapse

ALLOWED_KEYS =
%i[name url action on_stop auto_stop_in kubernetes].freeze

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

Instance Method Summary collapse

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

#compose!, #entry_create!

Methods inherited from Gitlab::Config::Entry::Node

#[], #add_warning, #ancestors, aspects, #compose!, default, #descendants, #errors, #initialize, #inspect, #integer?, #leaf?, #location, #opt, #relevant?, #specified?, #valid?, #warnings, with_aspect

Constructor Details

This class inherits a constructor from Gitlab::Config::Entry::Node

Instance Method Details

#actionObject


72
73
74
# File 'lib/gitlab/ci/config/entry/environment.rb', line 72

def action
  value[:action] || 'start'
end

#auto_stop_inObject


84
85
86
# File 'lib/gitlab/ci/config/entry/environment.rb', line 84

def auto_stop_in
  value[:auto_stop_in]
end

#hash?Boolean

Returns:

  • (Boolean)

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

def hash?
  @config.is_a?(Hash)
end

#kubernetesObject


80
81
82
# File 'lib/gitlab/ci/config/entry/environment.rb', line 80

def kubernetes
  value[:kubernetes]
end

#nameObject


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

def name
  value[:name]
end

#on_stopObject


76
77
78
# File 'lib/gitlab/ci/config/entry/environment.rb', line 76

def on_stop
  value[:on_stop]
end

#skip_config_hash_validation?Boolean

Returns:

  • (Boolean)

96
97
98
# File 'lib/gitlab/ci/config/entry/environment.rb', line 96

def skip_config_hash_validation?
  true
end

#string?Boolean

Returns:

  • (Boolean)

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

def string?
  @config.is_a?(String)
end

#urlObject


68
69
70
# File 'lib/gitlab/ci/config/entry/environment.rb', line 68

def url
  value[:url]
end

#valueObject


88
89
90
91
92
93
94
# File 'lib/gitlab/ci/config/entry/environment.rb', line 88

def value
  case @config
  when String then { name: @config, action: 'start' }
  when Hash then @config
  else {}
  end
end