Commit f3e836ac authored by Marcel Amirault's avatar Marcel Amirault

Merge branch 'docs-selhorn-fallback' into 'master'

Docs: Added fallback_cache_key

See merge request gitlab-org/gitlab!42101
parents de69f0ca 2f9aa429
...@@ -2819,6 +2819,8 @@ cache: ...@@ -2819,6 +2819,8 @@ cache:
- binaries/ - binaries/
``` ```
You can specify a [fallback cache key](#fallback-cache-key) to use if the specified `cache:key` is not found.
##### `cache:key:files` ##### `cache:key:files`
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18986) in GitLab v12.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18986) in GitLab v12.5.
...@@ -4404,6 +4406,32 @@ variables: ...@@ -4404,6 +4406,32 @@ variables:
You can set them globally or per-job in the [`variables`](#variables) section. You can set them globally or per-job in the [`variables`](#variables) section.
### Fallback cache key
> [Introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1534) in GitLab Runner 13.4.
You can use the `$CI_COMMIT_REF_SLUG` variable to specify your [`cache:key`](#cachekey).
For example, if your `$CI_COMMIT_REF_SLUG` is `test` you can set a job
to download cache that's tagged with `test`.
If a cache with this tag is not found, you can use `CACHE_FALLBACK_KEY` to
specify a cache to use when none exists.
For example:
```yaml
variables:
CACHE_FALLBACK_KEY: fallback-key
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- binaries/
```
In this example, if the `$CI_COMMIT_REF_SLUG` is not found, the job uses the key defined
by the `CACHE_FALLBACK_KEY` variable.
### Shallow cloning ### Shallow cloning
> Introduced in GitLab 8.9 as an experimental feature. > Introduced in GitLab 8.9 as an experimental feature.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment