summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/entry/environment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/entry/environment.rb')
-rw-r--r--lib/gitlab/ci/config/entry/environment.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/ci/config/entry/environment.rb b/lib/gitlab/ci/config/entry/environment.rb
index 64e6d48133f..2066e9be3b1 100644
--- a/lib/gitlab/ci/config/entry/environment.rb
+++ b/lib/gitlab/ci/config/entry/environment.rb
@@ -10,7 +10,7 @@ module Gitlab
class Environment < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Configurable
- ALLOWED_KEYS = %i[name url action on_stop auto_stop_in kubernetes].freeze
+ ALLOWED_KEYS = %i[name url action on_stop auto_stop_in kubernetes deployment_tier].freeze
entry :kubernetes, Entry::Kubernetes, description: 'Kubernetes deployment configuration.'
@@ -47,6 +47,11 @@ module Gitlab
inclusion: { in: %w[start stop prepare], message: 'should be start, stop or prepare' },
allow_nil: true
+ validates :deployment_tier,
+ type: String,
+ inclusion: { in: ::Environment.tiers.keys, message: "must be one of #{::Environment.tiers.keys.join(', ')}" },
+ allow_nil: true
+
validates :on_stop, type: String, allow_nil: true
validates :kubernetes, type: Hash, allow_nil: true
validates :auto_stop_in, duration: true, allow_nil: true
@@ -85,6 +90,10 @@ module Gitlab
value[:auto_stop_in]
end
+ def deployment_tier
+ value[:deployment_tier]
+ end
+
def value
case @config
when String then { name: @config, action: 'start' }