Class: Gitlab::Ci::Variables::Builder::Group

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

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(group) ⇒ Group

Returns a new instance of Group.


10
11
12
# File 'lib/gitlab/ci/variables/builder/group.rb', line 10

def initialize(group)
  @group = group
end

Instance Method Details

#secret_variables(environment:, protected_ref: false) ⇒ Object


14
15
16
17
18
19
20
21
22
23
# File 'lib/gitlab/ci/variables/builder/group.rb', line 14

def secret_variables(environment:, protected_ref: false)
  return [] unless group

  variables = base_scope
  variables = variables.unprotected unless protected_ref
  variables = variables.for_environment(environment)
  variables = variables.group_by(&:group_id)
  variables = list_of_ids.reverse.flat_map { |group| variables[group.id] }.compact
  Gitlab::Ci::Variables::Collection.new(variables)
end