debian-mirror-gitlab/lib/gitlab/ci/config/entry/variables.rb
2023-03-04 22:38:38 +05:30

51 lines
1.1 KiB
Ruby

# 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
def value_with_prefill_data
@entries.to_h do |key, entry|
[key.to_s, entry.value_with_prefill_data]
end
end
private
def composable_class(_name, _config)
Entry::Variable
end
def composable_metadata
{ allowed_value_data: opt(:allowed_value_data) }
end
end
end
end
end
end