Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/entry/tags.rb')
-rw-r--r--lib/gitlab/ci/config/entry/tags.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/gitlab/ci/config/entry/tags.rb b/lib/gitlab/ci/config/entry/tags.rb
new file mode 100644
index 00000000000..ca3b48372e2
--- /dev/null
+++ b/lib/gitlab/ci/config/entry/tags.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ class Config
+ module Entry
+ ##
+ # Entry that represents an array of tags.
+ #
+ class Tags < ::Gitlab::Config::Entry::Node
+ include ::Gitlab::Config::Entry::Validatable
+
+ TAGS_LIMIT = 50
+
+ validations do
+ validates :config, array_of_strings: true
+
+ validate do
+ next unless ::Feature.enabled?(:ci_build_tags_limit, default_enabled: :yaml)
+
+ if config.is_a?(Array) && config.size >= TAGS_LIMIT
+ errors.add(:config, _("must be less than the limit of %{tag_limit} tags") % { tag_limit: TAGS_LIMIT })
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end