Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-07-06 10:40:43 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2017-07-06 10:40:43 +0300
commit7f500acb5f38f0ae5d4e2d51e27b6257e0800c3d (patch)
treedb122866e3a238c8246a33bc91d5cd91cc09354d /lib/gitlab
parent6afe25ef336aca40b87cede499f8b8f5928129f6 (diff)
parent35f4a00f371ae60477bdbafe9f8274c8560320cb (diff)
Merge branch '33772-readonly-gitlab-ci-cache' into 'master'
Introduce cache policies for CI jobs Closes #33772 See merge request !12483
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/ci/config/entry/cache.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitlab/ci/config/entry/cache.rb b/lib/gitlab/ci/config/entry/cache.rb
index f074df9c7a1..d7e09acbbf3 100644
--- a/lib/gitlab/ci/config/entry/cache.rb
+++ b/lib/gitlab/ci/config/entry/cache.rb
@@ -7,11 +7,14 @@ module Gitlab
#
class Cache < Node
include Configurable
+ include Attributable
- ALLOWED_KEYS = %i[key untracked paths].freeze
+ ALLOWED_KEYS = %i[key untracked paths policy].freeze
+ DEFAULT_POLICY = 'pull-push'.freeze
validations do
validates :config, allowed_keys: ALLOWED_KEYS
+ validates :policy, inclusion: { in: %w[pull-push push pull], message: 'should be pull-push, push, or pull' }, allow_blank: true
end
entry :key, Entry::Key,
@@ -25,8 +28,15 @@ module Gitlab
helpers :key
+ attributes :policy
+
def value
- super.merge(key: key_value)
+ result = super
+
+ result[:key] = key_value
+ result[:policy] = policy || DEFAULT_POLICY
+
+ result
end
end
end