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

tags.rb « entry « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6044cfddbdc750fa496565d2be6a01b911c9e0f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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
              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