debian-mirror-gitlab/doc/ci/caching/index.md

586 lines
20 KiB
Markdown
Raw Normal View History

2019-09-04 21:01:54 +05:30
---
2020-06-23 00:09:42 +05:30
stage: Verify
group: Continuous Integration
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
2019-09-04 21:01:54 +05:30
type: index, concepts, howto
---
2018-04-04 21:44:52 +05:30
# Cache dependencies in GitLab CI/CD
GitLab CI/CD provides a caching mechanism that can be used to save time
when your jobs are running.
Caching is about speeding the time a job is executed by reusing the same
2019-09-30 21:07:59 +05:30
content of a previous job. It can be particularly useful when you are
2018-04-04 21:44:52 +05:30
developing software that depends on other libraries which are fetched via the
internet during build time.
2019-12-21 20:55:43 +05:30
If caching is enabled, it's shared between pipelines and jobs at the project
level by default, starting from GitLab 9.0. Caches are not shared across
projects.
2018-04-04 21:44:52 +05:30
Make sure you read the [`cache` reference](../yaml/README.md#cache) to learn
how it is defined in `.gitlab-ci.yml`.
2018-11-20 20:47:30 +05:30
## Cache vs artifacts
Be careful if you use cache and artifacts to store the same path in your jobs
2020-01-01 13:55:28 +05:30
as **caches are restored before artifacts** and the content could be overwritten.
Don't use caching for passing artifacts between stages, as it is designed to store
runtime dependencies needed to compile the project:
- `cache`: **For storing project dependencies**
Caches are used to speed up runs of a given job in **subsequent pipelines**, by
storing downloaded dependencies so that they don't have to be fetched from the
internet again (like npm packages, Go vendor packages, etc.) While the cache could
be configured to pass intermediate build results between stages, this should be
done with artifacts instead.
2018-12-05 23:21:45 +05:30
- `artifacts`: **Use for stage results that will be passed between stages.**
2020-01-01 13:55:28 +05:30
Artifacts are files generated by a job which are stored and uploaded, and can then
2020-05-24 23:13:21 +05:30
be fetched and used by jobs in later stages of the **same pipeline**. In other words,
[you can't create an artifact in job-A in stage-1, and then use this artifact in job-B in stage-1](https://gitlab.com/gitlab-org/gitlab/-/issues/25837).
This data will not be available in different pipelines, but is available to be downloaded
2020-01-01 13:55:28 +05:30
from the UI.
The name `artifacts` sounds like it's only useful outside of the job, like for downloading
a final image, but artifacts are also available in later stages within a pipeline.
So if you build your application by downloading all the required modules, you might
want to declare them as artifacts so that subsequent stages can use them. There are
some optimizations like declaring an [expiry time](../yaml/README.md#artifactsexpire_in)
so you don't keep artifacts around too long, or using [dependencies](../yaml/README.md#dependencies)
to control which jobs fetch the artifacts.
Caches:
- Are disabled if not defined globally or per job (using `cache:`).
- Are available for all jobs in your `.gitlab-ci.yml` if enabled globally.
- Can be used in subsequent pipelines by the same job in which the cache was created (if not defined globally).
2020-11-24 15:15:51 +05:30
- Are stored where GitLab Runner is installed **and** uploaded to S3 if [distributed cache is enabled](https://docs.gitlab.com/runner/configuration/autoscale.html#distributed-runners-caching).
2020-01-01 13:55:28 +05:30
- If defined per job, are used:
- By the same job in a subsequent pipeline.
2020-03-13 15:44:24 +05:30
- By subsequent jobs in the same pipeline, if they have identical dependencies.
2020-01-01 13:55:28 +05:30
Artifacts:
- Are disabled if not defined per job (using `artifacts:`).
- Can only be enabled per job, not globally.
- Are created during a pipeline and can be used by the subsequent jobs of that currently active pipeline.
- Are always uploaded to GitLab (known as coordinator).
- Can have an expiration value for controlling disk usage (30 days by default).
Both artifacts and caches define their paths relative to the project directory, and
can't link to files outside it.
2018-11-20 20:47:30 +05:30
2018-04-04 21:44:52 +05:30
## Good caching practices
We have the cache from the perspective of the developers (who consume a cache
2020-11-24 15:15:51 +05:30
within the job) and the cache from the perspective of the runner. Depending on
which type of runner you are using, cache can act differently.
2018-04-04 21:44:52 +05:30
From the perspective of the developer, to ensure maximum availability of the
cache, when declaring `cache` in your jobs, use one or a mix of the following:
2020-11-24 15:15:51 +05:30
- [Tag your runners](../runners/README.md#use-tags-to-limit-the-number-of-jobs-using-the-runner) and use the tag on jobs
2018-04-04 21:44:52 +05:30
that share their cache.
2020-11-24 15:15:51 +05:30
- [Use sticky runners](../runners/README.md#prevent-a-specific-runner-from-being-enabled-for-other-projects)
2018-04-04 21:44:52 +05:30
that will be only available to a particular project.
2019-09-04 21:01:54 +05:30
- [Use a `key`](../yaml/README.md#cachekey) that fits your workflow (for example,
2018-04-04 21:44:52 +05:30
different caches on each branch). For that, you can take advantage of the
2019-03-02 22:35:43 +05:30
[CI/CD predefined variables](../variables/README.md#predefined-environment-variables).
2018-04-04 21:44:52 +05:30
TIP: **Tip:**
2020-11-24 15:15:51 +05:30
Using the same runner for your pipeline, is the most simple and efficient way to
2018-04-04 21:44:52 +05:30
cache files in one stage or pipeline, and pass this cache to subsequent stages
or pipelines in a guaranteed manner.
2020-11-24 15:15:51 +05:30
From the perspective of the runner, in order for cache to work effectively, one
2018-04-04 21:44:52 +05:30
of the following must be true:
2020-11-24 15:15:51 +05:30
- Use a single runner for all your jobs.
- Use multiple runners (in autoscale mode or not) that use
2018-04-04 21:44:52 +05:30
[distributed caching](https://docs.gitlab.com/runner/configuration/autoscale.html#distributed-runners-caching),
2020-11-24 15:15:51 +05:30
where the cache is stored in S3 buckets (like shared runners on GitLab.com).
- Use multiple runners (not in autoscale mode) of the same architecture that
2018-04-04 21:44:52 +05:30
share a common network-mounted directory (using NFS or something similar)
2018-12-05 23:21:45 +05:30
where the cache will be stored.
2018-04-04 21:44:52 +05:30
TIP: **Tip:**
Read about the [availability of the cache](#availability-of-the-cache)
to learn more about the internals and get a better idea how cache works.
### Sharing caches across the same branch
Define a cache with the `key: ${CI_COMMIT_REF_SLUG}` so that jobs of each
branch always use the same cache:
```yaml
cache:
key: ${CI_COMMIT_REF_SLUG}
```
While this feels like it might be safe from accidentally overwriting the cache,
it means merge requests get slow first pipelines, which might be a bad
developer experience. The next time a new commit is pushed to the branch, the
cache will be re-used.
To enable per-job and per-branch caching:
```yaml
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
```
To enable per-branch and per-stage caching:
```yaml
cache:
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
```
### Sharing caches across different branches
If the files you are caching need to be shared across all branches and all jobs,
you can use the same key for all of them:
```yaml
cache:
2018-11-20 20:47:30 +05:30
key: one-key-to-rule-them-all
2018-04-04 21:44:52 +05:30
```
To share the same cache between branches, but separate them by job:
```yaml
cache:
key: ${CI_JOB_NAME}
```
### Disabling cache on specific jobs
If you have defined the cache globally, it means that each job will use the
same definition. You can override this behavior per-job, and if you want to
disable it completely, use an empty hash:
```yaml
job:
cache: {}
```
2019-12-04 20:38:33 +05:30
### 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
2020-11-24 15:15:51 +05:30
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- public/
- vendor/
policy: pull-push
2019-12-04 20:38:33 +05:30
job:
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull
```
2018-04-04 21:44:52 +05:30
For more fine tuning, read also about the
2019-07-07 11:18:12 +05:30
[`cache: policy`](../yaml/README.md#cachepolicy).
2018-04-04 21:44:52 +05:30
## Common use cases
The most common use case of cache is to preserve contents between subsequent
runs of jobs for things like dependencies and commonly used libraries
2020-03-13 15:44:24 +05:30
(Node.js packages, PHP packages, rubygems, Python libraries, etc.),
2018-04-04 21:44:52 +05:30
so they don't have to be re-fetched from the public internet.
2021-01-03 14:25:43 +05:30
For more examples, check out our [GitLab CI/CD templates](https://gitlab.com/gitlab-org/gitlab/tree/master/lib/gitlab/ci/templates).
2018-04-04 21:44:52 +05:30
2020-03-13 15:44:24 +05:30
### Caching Node.js dependencies
2018-04-04 21:44:52 +05:30
2020-04-08 14:13:33 +05:30
Assuming your project is using [npm](https://www.npmjs.com/) to install the Node.js
dependencies, the following example defines `cache` globally so that all jobs inherit it.
By default, npm stores cache data in the home folder `~/.npm` but since
[you can't cache things outside of the project directory](../yaml/README.md#cachepaths),
we tell npm to use `./.npm` instead, and it is cached per-branch:
2018-04-04 21:44:52 +05:30
```yaml
#
2020-04-22 19:07:51 +05:30
# https://gitlab.com/gitlab-org/gitlab/tree/master/lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml
2018-04-04 21:44:52 +05:30
#
image: node:latest
# Cache modules in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
2020-07-28 23:09:34 +05:30
- .npm/
2018-04-04 21:44:52 +05:30
before_script:
2020-04-08 14:13:33 +05:30
- npm ci --cache .npm --prefer-offline
2018-04-04 21:44:52 +05:30
test_async:
script:
2020-07-28 23:09:34 +05:30
- node ./specs/start.js ./specs/async.spec.js
2018-04-04 21:44:52 +05:30
```
### Caching PHP dependencies
Assuming your project is using [Composer](https://getcomposer.org/) to install
the PHP dependencies, the following example defines `cache` globally so that
all jobs inherit it. PHP libraries modules are installed in `vendor/` and
are cached per-branch:
```yaml
#
2020-04-22 19:07:51 +05:30
# https://gitlab.com/gitlab-org/gitlab/tree/master/lib/gitlab/ci/templates/PHP.gitlab-ci.yml
2018-04-04 21:44:52 +05:30
#
image: php:7.2
# Cache libraries in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
2020-07-28 23:09:34 +05:30
- vendor/
2018-04-04 21:44:52 +05:30
before_script:
2020-07-28 23:09:34 +05:30
# Install and run Composer
- curl --show-error --silent https://getcomposer.org/installer | php
- php composer.phar install
2018-04-04 21:44:52 +05:30
test:
script:
2020-07-28 23:09:34 +05:30
- vendor/bin/phpunit --configuration phpunit.xml --coverage-text --colors=never
2018-04-04 21:44:52 +05:30
```
### Caching Python dependencies
Assuming your project is using [pip](https://pip.pypa.io/en/stable/) to install
2019-12-21 20:55:43 +05:30
the Python dependencies, the following example defines `cache` globally so that
2020-04-22 19:07:51 +05:30
all jobs inherit it. Python libraries are installed in a virtual environment under `venv/`,
2018-04-04 21:44:52 +05:30
pip's cache is defined under `.cache/pip/` and both are cached per-branch:
```yaml
#
2020-04-22 19:07:51 +05:30
# https://gitlab.com/gitlab-org/gitlab/tree/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml
2018-04-04 21:44:52 +05:30
#
image: python:latest
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
2020-11-24 15:15:51 +05:30
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
2018-04-04 21:44:52 +05:30
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
2018-12-13 13:39:08 +05:30
- .cache/pip
2018-04-04 21:44:52 +05:30
- venv/
before_script:
- python -V # Print out python version for debugging
- pip install virtualenv
- virtualenv venv
- source venv/bin/activate
test:
script:
2020-07-28 23:09:34 +05:30
- python setup.py test
- pip install flake8
- flake8 .
2018-04-04 21:44:52 +05:30
```
### Caching Ruby dependencies
Assuming your project is using [Bundler](https://bundler.io) to install the
gem dependencies, the following example defines `cache` globally so that all
jobs inherit it. Gems are installed in `vendor/ruby/` and are cached per-branch:
```yaml
#
2020-04-22 19:07:51 +05:30
# https://gitlab.com/gitlab-org/gitlab/tree/master/lib/gitlab/ci/templates/Ruby.gitlab-ci.yml
2018-04-04 21:44:52 +05:30
#
2019-09-04 21:01:54 +05:30
image: ruby:2.6
2018-04-04 21:44:52 +05:30
# Cache gems in between builds
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/ruby
before_script:
2020-03-13 15:44:24 +05:30
- ruby -v # Print out ruby version for debugging
- bundle install -j $(nproc) --path vendor/ruby # Install dependencies into ./vendor/ruby
2018-04-04 21:44:52 +05:30
rspec:
script:
2020-07-28 23:09:34 +05:30
- rspec spec
2018-04-04 21:44:52 +05:30
```
2020-04-22 19:07:51 +05:30
### Caching Go dependencies
Assuming your project is using [Go Modules](https://github.com/golang/go/wiki/Modules) to install
Go dependencies, the following example defines `cache` in a `go-cache` template, that
any job can extend. Go modules are installed in `${GOPATH}/pkg/mod/` and
are cached for all of the `go` projects:
```yaml
.go-cache:
variables:
GOPATH: $CI_PROJECT_DIR/.go
before_script:
- mkdir -p .go
cache:
paths:
- .go/pkg/mod/
test:
image: golang:1.13
extends: .go-cache
script:
2020-07-28 23:09:34 +05:30
- go test ./... -v -short
2020-04-22 19:07:51 +05:30
```
2018-04-04 21:44:52 +05:30
## Availability of the cache
Caching is an optimization, but isn't guaranteed to always work, so you need to
be prepared to regenerate any cached files in each job that needs them.
Assuming you have properly [defined `cache` in `.gitlab-ci.yml`](../yaml/README.md#cache)
according to your workflow, the availability of the cache ultimately depends on
2020-11-24 15:15:51 +05:30
how the runner has been configured (the executor type and whether different
runners are used for passing the cache between jobs).
2018-04-04 21:44:52 +05:30
### Where the caches are stored
2020-11-24 15:15:51 +05:30
Since the runner is the one responsible for storing the cache, it's essential
2018-04-04 21:44:52 +05:30
to know **where** it's stored. All the cache paths defined under a job in
`.gitlab-ci.yml` are archived in a single `cache.zip` file and stored in the
2020-11-24 15:15:51 +05:30
runner's configured cache location. By default, they are stored locally in the
machine where the runner is installed and depends on the type of the executor.
2018-04-04 21:44:52 +05:30
| GitLab Runner executor | Default path of the cache |
| ---------------------- | ------------------------- |
| [Shell](https://docs.gitlab.com/runner/executors/shell.html) | Locally, stored under the `gitlab-runner` user's home directory: `/home/gitlab-runner/cache/<user>/<project>/<cache-key>/cache.zip`. |
| [Docker](https://docs.gitlab.com/runner/executors/docker.html) | Locally, stored under [Docker volumes](https://docs.gitlab.com/runner/executors/docker.html#the-builds-and-cache-storage): `/var/lib/docker/volumes/<volume-id>/_data/<user>/<project>/<cache-key>/cache.zip`. |
2020-11-24 15:15:51 +05:30
| [Docker machine](https://docs.gitlab.com/runner/executors/docker_machine.html) (autoscale runners) | Behaves the same as the Docker executor. |
2018-04-04 21:44:52 +05:30
### How archiving and extracting works
In the most simple scenario, consider that you use only one machine where the
2020-11-24 15:15:51 +05:30
runner is installed, and all jobs of your project run on the same host.
2018-04-04 21:44:52 +05:30
Let's see the following example of two jobs that belong to two consecutive
stages:
```yaml
stages:
2020-07-28 23:09:34 +05:30
- build
- test
2018-04-04 21:44:52 +05:30
before_script:
2020-07-28 23:09:34 +05:30
- echo "Hello"
2018-04-04 21:44:52 +05:30
job A:
stage: build
script:
2020-07-28 23:09:34 +05:30
- mkdir vendor/
- echo "build" > vendor/hello.txt
2018-04-04 21:44:52 +05:30
cache:
key: build-cache
paths:
2020-07-28 23:09:34 +05:30
- vendor/
2018-04-04 21:44:52 +05:30
after_script:
2020-07-28 23:09:34 +05:30
- echo "World"
2018-04-04 21:44:52 +05:30
job B:
stage: test
script:
2020-07-28 23:09:34 +05:30
- cat vendor/hello.txt
2018-04-04 21:44:52 +05:30
cache:
key: build-cache
```
Here's what happens behind the scenes:
2018-12-05 23:21:45 +05:30
1. Pipeline starts.
1. `job A` runs.
1. `before_script` is executed.
1. `script` is executed.
1. `after_script` is executed.
2018-04-04 21:44:52 +05:30
1. `cache` runs and the `vendor/` directory is zipped into `cache.zip`.
2019-10-12 21:52:04 +05:30
This file is then saved in the directory based on the
2020-11-24 15:15:51 +05:30
[runner's setting](#where-the-caches-are-stored) and the `cache: key`.
2018-12-05 23:21:45 +05:30
1. `job B` runs.
1. The cache is extracted (if found).
1. `before_script` is executed.
1. `script` is executed.
1. Pipeline finishes.
2018-04-04 21:44:52 +05:30
2020-11-24 15:15:51 +05:30
By using a single runner on a single machine, you'll not have the issue where
`job B` might execute on a runner different from `job A`, thus guaranteeing the
2018-04-04 21:44:52 +05:30
cache between stages. That will only work if the build goes from stage `build`
2020-11-24 15:15:51 +05:30
to `test` in the same runner/machine, otherwise, you [might not have the cache
2018-04-04 21:44:52 +05:30
available](#cache-mismatch).
During the caching process, there's also a couple of things to consider:
- If some other job, with another cache configuration had saved its
cache in the same zip file, it is overwritten. If the S3 based shared cache is
used, the file is additionally uploaded to S3 to an object based on the cache
key. So, two jobs with different paths, but the same cache key, will overwrite
their cache.
- When extracting the cache from `cache.zip`, everything in the zip file is
extracted in the job's working directory (usually the repository which is
2020-11-24 15:15:51 +05:30
pulled down), and the runner doesn't mind if the archive of `job A` overwrites
2018-04-04 21:44:52 +05:30
things in the archive of `job B`.
2020-11-24 15:15:51 +05:30
The reason why it works this way is because the cache created for one runner
2018-04-04 21:44:52 +05:30
often will not be valid when used by a different one which can run on a
**different architecture** (e.g., when the cache includes binary files). And
2020-11-24 15:15:51 +05:30
since the different steps might be executed by runners running on different
2018-04-04 21:44:52 +05:30
machines, it is a safe default.
### Cache mismatch
In the following table, you can see some reasons where you might hit a cache
mismatch and a few ideas how to fix it.
| Reason of a cache mismatch | How to fix it |
| -------------------------- | ------------- |
2020-11-24 15:15:51 +05:30
| You use multiple standalone runners (not in autoscale mode) attached to one project without a shared cache | Use only one runner for your project or use multiple runners with distributed cache enabled |
| You use runners in autoscale mode without a distributed cache enabled | Configure the autoscale runner to use a distributed cache |
| The machine the runner is installed on is low on disk space or, if you've set up distributed cache, the S3 bucket where the cache is stored doesn't have enough space | Make sure you clear some space to allow new caches to be stored. Currently, there's no automatic way to do this. |
2018-04-04 21:44:52 +05:30
| You use the same `key` for jobs where they cache different paths. | Use different cache keys to that the cache archive is stored to a different location and doesn't overwrite wrong caches. |
Let's explore some examples.
2019-09-04 21:01:54 +05:30
#### Examples
2018-04-04 21:44:52 +05:30
2020-11-24 15:15:51 +05:30
Let's assume you have only one runner assigned to your project, so the cache
will be stored in the runner's machine by default. If two jobs, A and B,
2018-04-04 21:44:52 +05:30
have the same cache key, but they cache different paths, cache B would overwrite
cache A, even if their `paths` don't match:
We want `job A` and `job B` to re-use their
cache when the pipeline is run for a second time.
```yaml
stages:
2020-07-28 23:09:34 +05:30
- build
- test
2018-04-04 21:44:52 +05:30
job A:
stage: build
script: make build
cache:
key: same-key
paths:
2020-07-28 23:09:34 +05:30
- public/
2018-04-04 21:44:52 +05:30
job B:
stage: test
script: make test
cache:
key: same-key
paths:
2020-07-28 23:09:34 +05:30
- vendor/
2018-04-04 21:44:52 +05:30
```
2018-12-05 23:21:45 +05:30
1. `job A` runs.
1. `public/` is cached as cache.zip.
1. `job B` runs.
1. The previous cache, if any, is unzipped.
1. `vendor/` is cached as cache.zip and overwrites the previous one.
2018-04-04 21:44:52 +05:30
1. The next time `job A` runs it will use the cache of `job B` which is different
2018-12-05 23:21:45 +05:30
and thus will be ineffective.
2018-04-04 21:44:52 +05:30
To fix that, use different `keys` for each job.
2020-11-24 15:15:51 +05:30
In another case, let's assume you have more than one runner assigned to your
2019-12-21 20:55:43 +05:30
project, but the distributed cache is not enabled. The second time the
pipeline is run, we want `job A` and `job B` to re-use their cache (which in this case
2018-04-04 21:44:52 +05:30
will be different):
```yaml
stages:
2020-07-28 23:09:34 +05:30
- build
- test
2018-04-04 21:44:52 +05:30
job A:
stage: build
script: build
cache:
key: keyA
paths:
2020-07-28 23:09:34 +05:30
- vendor/
2018-04-04 21:44:52 +05:30
job B:
stage: test
script: test
cache:
key: keyB
paths:
2020-07-28 23:09:34 +05:30
- vendor/
2018-04-04 21:44:52 +05:30
```
In that case, even if the `key` is different (no fear of overwriting), you
2019-12-21 20:55:43 +05:30
might experience that the cached files "get cleaned" before each stage if the
2020-11-24 15:15:51 +05:30
jobs run on different runners in the subsequent pipelines.
2018-04-04 21:44:52 +05:30
## Clearing the cache
2020-11-24 15:15:51 +05:30
Runners use [cache](../yaml/README.md#cache) to speed up the execution
2018-04-04 21:44:52 +05:30
of your jobs by reusing existing data. This however, can sometimes lead to an
inconsistent behavior.
To start with a fresh copy of the cache, there are two ways to do that.
### Clearing the cache by changing `cache:key`
All you have to do is set a new `cache: key` in your `.gitlab-ci.yml`. In the
next run of the pipeline, the cache will be stored in a different location.
### Clearing the cache manually
2020-06-23 00:09:42 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41249) in GitLab 10.4.
2018-04-04 21:44:52 +05:30
If you want to avoid editing `.gitlab-ci.yml`, you can easily clear the cache
2018-05-09 12:01:36 +05:30
via GitLab's UI:
2018-04-04 21:44:52 +05:30
2018-12-05 23:21:45 +05:30
1. Navigate to your project's **CI/CD > Pipelines** page.
2020-11-24 15:15:51 +05:30
1. Click on the **Clear runner caches** button to clean up the cache.
2018-05-09 12:01:36 +05:30
2020-11-24 15:15:51 +05:30
![Clear runner caches](img/clear_runners_cache.png)
2018-05-09 12:01:36 +05:30
2018-12-05 23:21:45 +05:30
1. On the next push, your CI/CD job will use a new cache.
2018-04-04 21:44:52 +05:30
Behind the scenes, this works by increasing a counter in the database, and the
2018-05-09 12:01:36 +05:30
value of that counter is used to create the key for the cache by appending an
integer to it: `-1`, `-2`, etc. After a push, a new key is generated and the
old cache is not valid anymore.
2019-09-04 21:01:54 +05:30
<!-- ## Troubleshooting
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->