Class: Gitlab::Ci::Pipeline::Seed::Build::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/pipeline/seed/build/cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(pipeline, cache) ⇒ Cache

Returns a new instance of Cache.

Raises:

  • (ArgumentError)

9
10
11
12
13
14
15
16
17
18
# File 'lib/gitlab/ci/pipeline/seed/build/cache.rb', line 9

def initialize(pipeline, cache)
  @pipeline = pipeline
  local_cache = cache.to_h.deep_dup
  @key = local_cache.delete(:key)
  @paths = local_cache.delete(:paths)
  @policy = local_cache.delete(:policy)
  @untracked = local_cache.delete(:untracked)

  raise ArgumentError, "unknown cache keys: #{local_cache.keys}" if local_cache.any?
end

Instance Method Details

#build_attributesObject


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gitlab/ci/pipeline/seed/build/cache.rb', line 20

def build_attributes
  {
    options: {
      cache: {
        key: key_string,
        paths: @paths,
        policy: @policy,
        untracked: @untracked
      }.compact.presence
    }.compact
  }
end