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 inherited from Base

#all_worktree_paths, #project, #sha, #top_level_worktree_paths, #variables_hash

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
# 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.reject { |var| var[:key] =~ /\ACI_(JOB|BUILD)/ }
  end
end