2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
class Config
|
2017-08-17 22:00:37 +05:30
|
|
|
module Entry
|
2016-08-24 12:49:21 +05:30
|
|
|
##
|
2022-10-11 01:57:18 +05:30
|
|
|
# Entry that represents CI/CD variables.
|
2022-11-25 23:54:43 +05:30
|
|
|
class Variables < ::Gitlab::Config::Entry::ComposableHash
|
|
|
|
include ::Gitlab::Config::Entry::Validatable
|
|
|
|
|
|
|
|
validations do
|
|
|
|
validates :config, type: Hash
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
|
2019-03-02 22:35:43 +05:30
|
|
|
def self.default(**)
|
2016-08-24 12:49:21 +05:30
|
|
|
{}
|
|
|
|
end
|
2022-11-25 23:54:43 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
def value_with_prefill_data
|
|
|
|
@entries.to_h do |key, entry|
|
|
|
|
[key.to_s, entry.value_with_prefill_data]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
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
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|