summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/entry/cache.rb
blob: f074df9c7a1d789bfc813c094fc5020adec612aa (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
26
27
28
29
30
31
32
33
34
35
module Gitlab
  module Ci
    class Config
      module Entry
        ##
        # Entry that represents a cache configuration
        #
        class Cache < Node
          include Configurable

          ALLOWED_KEYS = %i[key untracked paths].freeze

          validations do
            validates :config, allowed_keys: ALLOWED_KEYS
          end

          entry :key, Entry::Key,
            description: 'Cache key used to define a cache affinity.'

          entry :untracked, Entry::Boolean,
            description: 'Cache all untracked files.'

          entry :paths, Entry::Paths,
            description: 'Specify which paths should be cached across builds.'

          helpers :key

          def value
            super.merge(key: key_value)
          end
        end
      end
    end
  end
end