diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2018-05-09 16:23:11 +0000 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2018-05-09 16:23:11 +0000 |
commit | ade1db58e3b8638a91dcb5f35b888339fef4c185 (patch) | |
tree | 79338229e9aebb8147eeeb87b34538378db11d4c /doc/ci | |
parent | 5ea93ac36c9723112fbf4347e47a839330b1cc14 (diff) | |
parent | eb2351936c7efefa88104d647f60b77584789c39 (diff) | |
download | gitlab-ce-ade1db58e3b8638a91dcb5f35b888339fef4c185.tar.gz |
Merge branch '45840-fix-cache-key-docs' into 'master'
Resolve "Incorrect documentation for .gitlab-ci.yml cache:key default value"
Closes #45840
See merge request gitlab-org/gitlab-ce!18841
Diffstat (limited to 'doc/ci')
-rw-r--r-- | doc/ci/yaml/README.md | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index fb6d9826d08..2a17a51d7f8 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -738,10 +738,15 @@ cache: rspec: script: test cache: + key: rspec paths: - binaries/ ``` +Note that since cache is shared between jobs, if you're using different +paths for different jobs, you should also set a different **cache:key** +otherwise cache content can be overwritten. + ### `cache:key` > Introduced in GitLab Runner v1.0.0. @@ -756,10 +761,9 @@ or any other way that fits your workflow. This way, you can 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), and the default key, if not set, -is `$CI_JOB_NAME-$CI_COMMIT_REF_NAME` which translates as "per-job and -per-branch". It is the default across the project, therefore everything is -shared between pipelines and jobs running on the same branch by default. +[predefined variables](../variables/README.md), and the default key, if not +set, is just literal `default` which means everything is shared between each +pipelines and jobs by default, starting from GitLab 9.0. NOTE: **Note:** The `cache:key` variable cannot contain the `/` character, or the equivalent @@ -779,7 +783,7 @@ If you use **Windows Batch** to run your shell scripts you need to replace ```yaml cache: - key: "%CI_JOB_STAGE%-%CI_COMMIT_REF_SLUG%" + key: "%CI_COMMIT_REF_SLUG%" paths: - binaries/ ``` @@ -789,7 +793,7 @@ If you use **Windows PowerShell** to run your shell scripts you need to replace ```yaml cache: - key: "$env:CI_JOB_STAGE-$env:CI_COMMIT_REF_SLUG" + key: "$env:CI_COMMIT_REF_SLUG" paths: - binaries/ ``` @@ -1572,7 +1576,7 @@ capitalization, the commit will be created but the pipeline will be skipped. ## Validate the .gitlab-ci.yml Each instance of GitLab CI has an embedded debug tool called Lint, which validates the -content of your `.gitlab-ci.yml` files. You can find the Lint under the page `ci/lint` of your +content of your `.gitlab-ci.yml` files. You can find the Lint under the page `ci/lint` of your project namespace (e.g, `http://gitlab-example.com/gitlab-org/project-123/-/ci/lint`) ## Using reserved keywords |