Class: Gitlab::Ci::Build::Context::Global

Inherits:
Base
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/build/context/global.rb

Instance Attribute Summary

Attributes inherited from Base

#pipeline

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(pipeline, yaml_variables:) ⇒ Global

Returns a new instance of Global.


10
11
12
13
14
# File 'lib/gitlab/ci/build/context/global.rb', line 10

def initialize(pipeline, yaml_variables:)
  super(pipeline)

  @yaml_variables = yaml_variables.to_a
end

Instance Method Details

#variablesObject


16
17
18
19
20
21
22
23
24
25
# File 'lib/gitlab/ci/build/context/global.rb', line 16

def variables
  strong_memoize(:variables) do
    # This is a temporary piece of technical debt to allow us access
    # to the CI variables to evaluate workflow:rules
    # with the result. We should refactor away the extra Build.new,
    # but be able to get CI Variables directly from the Seed::Build.
    stub_build.scoped_variables_hash
      .reject { |key, _value| key =~ /\ACI_(JOB|BUILD)/ }
  end
end