summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/entry/cache.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/entry/cache.rb')
-rw-r--r--lib/gitlab/ci/config/entry/cache.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/ci/config/entry/cache.rb b/lib/gitlab/ci/config/entry/cache.rb
index a5481071fc5..a635f409109 100644
--- a/lib/gitlab/ci/config/entry/cache.rb
+++ b/lib/gitlab/ci/config/entry/cache.rb
@@ -9,7 +9,7 @@ module Gitlab
include ::Gitlab::Config::Entry::Validatable
include ::Gitlab::Config::Entry::Attributable
- ALLOWED_KEYS = %i[key untracked paths when policy].freeze
+ ALLOWED_KEYS = %i[key untracked paths when policy unprotect].freeze
ALLOWED_POLICY = %w[pull-push push pull].freeze
DEFAULT_POLICY = 'pull-push'
ALLOWED_WHEN = %w[on_success on_failure always].freeze
@@ -33,18 +33,22 @@ module Gitlab
entry :key, Entry::Key,
description: 'Cache key used to define a cache affinity.'
+ entry :unprotect, ::Gitlab::Config::Entry::Boolean,
+ description: 'Unprotect the cache from a protected ref.'
+
entry :untracked, ::Gitlab::Config::Entry::Boolean,
description: 'Cache all untracked files.'
entry :paths, Entry::Paths,
description: 'Specify which paths should be cached across builds.'
- attributes :policy, :when
+ attributes :policy, :when, :unprotect
def value
result = super
result[:key] = key_value
+ result[:unprotect] = unprotect || false
result[:policy] = policy || DEFAULT_POLICY
# Use self.when to avoid conflict with reserved word
result[:when] = self.when || DEFAULT_WHEN