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
path: root/doc/ci/yaml
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-01-14 19:52:59 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-01-21 01:12:48 +0300
commitc45a6bf3ba13cbd532852dfcc48ef3fd7aa545e4 (patch)
tree1482a8d5a7e705bf1d19c37e690ff6b0a13b0fbd /doc/ci/yaml
parent714f95b2ff68c02eeee9151c9b456bb2afe7eaff (diff)
Added cache:key to .gitlab-ci.yml allowing to fine tune the caching
Diffstat (limited to 'doc/ci/yaml')
-rw-r--r--doc/ci/yaml/README.md60
1 files changed, 56 insertions, 4 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index fd0d49de4e4..3b594df659d 100644
--- a/doc/ci/yaml/README.md
+++ b/doc/ci/yaml/README.md
@@ -135,10 +135,9 @@ thus allowing to fine tune them.
### cache
`cache` is used to specify a list of files and directories which should be
-cached between builds. Caches are stored according to the branch/ref and the
-job name. They are not currently shared between different job names or between
-branches/refs, which means that caching will benefit you if you push subsequent
-commits to an existing feature branch.
+cached between builds.
+
+**By default the caching is enabled per-job and per-branch.**
If `cache` is defined outside the scope of the jobs, it means it is set
globally and all jobs will use its definition.
@@ -152,6 +151,59 @@ cache:
- binaries/
```
+#### cache:key
+
+_**Note:** Introduced in GitLab Runner v1.0.0._
+
+The `key` directive allows you to define the affinity of caching
+between jobs, allowing to have a single cache for all jobs,
+cache per-job, cache per-branch or any other way you deem proper.
+
+This allows you to fine tune caching, allowing you to cache data between different jobs or even different branches.
+The `cache:key` variable can use any of the [predefined variables](../variables/README.md):
+
+Example configurations:
+
+To enable per-job caching:
+
+ ```yaml
+ cache:
+ key: "$CI_BUILD_NAME"
+ untracked: true
+ ```
+
+To enable per-branch caching:
+
+ ```yaml
+ cache:
+ key: "$CI_BUILD_REF_NAME"
+ untracked: true
+ ```
+
+To enable per-job and per-branch caching:
+
+ ```yaml
+ cache:
+ key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
+ untracked: true
+ ```
+
+To enable per-branch and per-stage caching:
+
+ ```yaml
+ cache:
+ key: "$CI_BUILD_STAGE/$CI_BUILD_REF_NAME"
+ untracked: true
+ ```
+
+If you use **Windows Batch** to run your shell scripts you need to replace the `$` with `%`:
+
+ ```yaml
+ cache:
+ key: "%CI_BUILD_STAGE%/%CI_BUILD_REF_NAME%"
+ untracked: true
+ ```
+
## Jobs
`.gitlab-ci.yml` allows you to specify an unlimited number of jobs. Each job