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

variables.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: 4430a11dda73bd8b7b550f9ebed141871a67e756 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

module Gitlab
  module Ci
    class Config
      module Entry
        ##
        # Entry that represents CI/CD variables.
        class Variables < ::Gitlab::Config::Entry::ComposableHash
          include ::Gitlab::Config::Entry::Validatable

          validations do
            validates :config, type: Hash
          end

          def self.default(**)
            {}
          end

          def value
            @entries.to_h do |key, entry|
              [key.to_s, entry.value]
            end
          end

          def value_with_data
            @entries.to_h do |key, entry|
              [key.to_s, entry.value_with_data]
            end
          end

          private

          def composable_class(_name, _config)
            Entry::Variable
          end

          def composable_metadata
            { allowed_value_data: opt(:allowed_value_data), allow_array_value: opt(:allow_array_value) }
          end
        end
      end
    end
  end
end