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

input.rb « header « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dcb960064597376adb0a3791e0e19491c2f75a9a (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
29
30
# frozen_string_literal: true

module Gitlab
  module Ci
    class Config
      module Header
        ##
        # Input parameter used for interpolation with the CI configuration.
        #
        class Input < ::Gitlab::Config::Entry::Node
          include ::Gitlab::Config::Entry::Validatable
          include ::Gitlab::Config::Entry::Attributable

          ALLOWED_KEYS = %i[default description regex type].freeze

          attributes ALLOWED_KEYS, prefix: :input

          validations do
            validates :config, type: Hash, allowed_keys: ALLOWED_KEYS
            validates :key, alphanumeric: true
            validates :input_default, alphanumeric: true, allow_nil: true
            validates :input_description, alphanumeric: true, allow_nil: true
            validates :input_regex, type: String, allow_nil: true
            validates :input_type, allow_nil: true, allowed_values: Interpolation::Inputs.input_types
          end
        end
      end
    end
  end
end