summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/variables/builder/project.rb
blob: 832e68ea6a27dc26d1820843d7f2afde0248946b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Gitlab
  module Ci
    module Variables
      class Builder
        class Project
          include Gitlab::Utils::StrongMemoize

          def initialize(project)
            @project = project
          end

          def secret_variables(environment:, protected_ref: false)
            variables = @project.variables
            variables = variables.unprotected unless protected_ref
            variables = variables.for_environment(environment)

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