blob: 2481989060ef2b4e63fa39de95ef192a28ac7579 (
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
|
# frozen_string_literal: true
module Gitlab
module Ci
class Config
module Entry
##
# Entry that represents variables for parallel matrix builds.
#
module Product
class Variables < ::Gitlab::Config::Entry::Node
include ::Gitlab::Config::Entry::Validatable
validations do
validates :config, variables: { array_values: true }
validates :config, length: {
minimum: :minimum,
too_short: 'requires at least %{count} items'
}
end
def self.default(**)
{}
end
def value
@config
.map { |key, value| [key.to_s, Array(value).map(&:to_s)] }
.to_h
end
def minimum
::Gitlab::Ci::Features.one_dimensional_matrix_enabled? ? 1 : 2
end
end
end
end
end
end
end
|