2018-10-26 04:12:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-22 09:22:53 +00:00
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
class Config
|
2016-11-14 10:46:41 +00:00
|
|
|
module Entry
|
2016-06-22 09:22:53 +00:00
|
|
|
##
|
2022-08-31 12:13:01 +00:00
|
|
|
# Entry that represents CI/CD variables.
|
2022-09-21 18:10:44 +00:00
|
|
|
class Variables < ::Gitlab::Config::Entry::ComposableHash
|
|
|
|
include ::Gitlab::Config::Entry::Validatable
|
|
|
|
|
|
|
|
validations do
|
|
|
|
validates :config, type: Hash
|
2016-06-22 12:26:33 +00:00
|
|
|
end
|
|
|
|
|
2019-01-14 13:22:13 +00:00
|
|
|
def self.default(**)
|
2016-06-22 12:26:33 +00:00
|
|
|
{}
|
2016-06-22 09:22:53 +00:00
|
|
|
end
|
2022-09-21 18:10:44 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-10-26 18:11:17 +00:00
|
|
|
def value_with_prefill_data
|
|
|
|
@entries.to_h do |key, entry|
|
|
|
|
[key.to_s, entry.value_with_prefill_data]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-09-21 18:10:44 +00:00
|
|
|
private
|
|
|
|
|
|
|
|
def composable_class(_name, _config)
|
|
|
|
Entry::Variable
|
|
|
|
end
|
|
|
|
|
|
|
|
def composable_metadata
|
2022-10-12 15:09:17 +00:00
|
|
|
{ allowed_value_data: opt(:allowed_value_data), allow_array_value: opt(:allow_array_value) }
|
2022-09-21 18:10:44 +00:00
|
|
|
end
|
2016-06-22 09:22:53 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|