diff options
Diffstat (limited to 'lib/gitlab/ci/config/entry/variables.rb')
-rw-r--r-- | lib/gitlab/ci/config/entry/variables.rb | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/gitlab/ci/config/entry/variables.rb b/lib/gitlab/ci/config/entry/variables.rb index 0284958d9d4..4430a11dda7 100644 --- a/lib/gitlab/ci/config/entry/variables.rb +++ b/lib/gitlab/ci/config/entry/variables.rb @@ -6,20 +6,38 @@ module Gitlab module Entry ## # Entry that represents CI/CD variables. - # CurrentVariables will be renamed to this class when removing the FF `ci_variables_refactoring_to_variable`. - # - class Variables - def self.new(...) - if YamlProcessor::FeatureFlags.enabled?(:ci_variables_refactoring_to_variable) - CurrentVariables.new(...) - else - LegacyVariables.new(...) - end + 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 |