summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Read <eread@gitlab.com>2019-08-27 06:10:45 +0000
committerEvan Read <eread@gitlab.com>2019-08-27 06:10:45 +0000
commitb23dbdf41a047bcf9c001cc34b88a3ce05b69d75 (patch)
treec5659d32f6e81c56b4e7bd469e3ef1fcafa90ba9
parent35293821039d64957895190963ed0d53bf93f0ce (diff)
parent0b32c3a21cb866a8c13a47a47d6975287d98f094 (diff)
downloadgitlab-ce-b23dbdf41a047bcf9c001cc34b88a3ce05b69d75.tar.gz
Merge branch 'patch-25' into 'master'
[#2838] add cache override explanation See merge request gitlab-org/gitlab-ce!32024
-rw-r--r--doc/ci/caching/index.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/ci/caching/index.md b/doc/ci/caching/index.md
index f8151e3e18c..a59a0477b80 100644
--- a/doc/ci/caching/index.md
+++ b/doc/ci/caching/index.md
@@ -172,6 +172,29 @@ job:
cache: {}
```
+### Inherit global config, but override specific settings per job
+
+You can override cache settings without overwriting the global cache by using
+[anchors](../yaml/README.md#anchors). For example, if you want to override the
+`policy` for one job:
+
+```yaml
+cache: &global_cache
+ key: ${CI_COMMIT_REF_SLUG}
+ paths:
+ - node_modules/
+ - public/
+ - vendor/
+ policy: pull-push
+
+job:
+ cache:
+ # inherit all global cache settings
+ <<: *global_cache
+ # override the policy
+ policy: pull
+```
+
For more fine tuning, read also about the
[`cache: policy`](../yaml/README.md#cachepolicy).