Class: Gitlab::Ci::Variables::Builder::Instance

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/variables/builder/instance.rb

Instance Method Summary collapse

Instance Method Details

#secret_variables(protected_ref: false, only: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gitlab/ci/variables/builder/instance.rb', line 10

def secret_variables(protected_ref: false, only: nil)
  variables = if protected_ref
                ::Ci::InstanceVariable.all_cached
              else
                ::Ci::InstanceVariable.unprotected_cached
              end

  # Due to caching logic these variables are an array so we can't use ActiveRecord.where
  variables = variables.filter { |v| only.nil? || v.key.in?(only) }

  Gitlab::Ci::Variables::Collection.new(variables)
end