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:
authorJames Lopez <james@jameslopez.es>2016-01-22 20:01:38 +0300
committerJames Lopez <james@jameslopez.es>2016-01-22 20:01:38 +0300
commit3d81f1da6e9a0b7370c3318a9f7851af88918ace (patch)
tree0265dc26079da9975184de44d9b28bfb9bd9d357 /doc/ci/yaml
parentba07a4c96a90a0cbe81ae7e987f32cc8eac20323 (diff)
parent0e51ca7c4841bb388c0decb57ecc64af86c77805 (diff)
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into update-ruby-2.2.4
# Conflicts: # .gitlab-ci.yml
Diffstat (limited to 'doc/ci/yaml')
-rw-r--r--doc/ci/yaml/README.md65
1 files changed, 61 insertions, 4 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md
index 779b9db6486..4d280297dbb 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,64 @@ 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
+`$` 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