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 deployment_tier].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, #deprecation, #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, #array?, 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



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

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

#auto_stop_inObject



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

def auto_stop_in
  value[:auto_stop_in]
end

#deployment_tierObject



93
94
95
# File 'lib/gitlab/ci/config/entry/environment.rb', line 93

def deployment_tier
  value[:deployment_tier]
end

#hash?Boolean

Returns:

  • (Boolean)


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

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

#kubernetesObject



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

def kubernetes
  value[:kubernetes]
end

#nameObject



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

def name
  value[:name]
end

#on_stopObject



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

def on_stop
  value[:on_stop]
end

#skip_config_hash_validation?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/gitlab/ci/config/entry/environment.rb', line 105

def skip_config_hash_validation?
  true
end

#string?Boolean

Returns:

  • (Boolean)


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

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

#urlObject



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

def url
  value[:url]
end

#valueObject



97
98
99
100
101
102
103
# File 'lib/gitlab/ci/config/entry/environment.rb', line 97

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