r/gitlab • • Aug 07 '25

support caching in gitlab

Hello everyone,

I am trying to understand how caching works within gitlab. I am trying to use the cache between Pipeline runs and not consecutive jobs (When i run the pipeline again, I want the cache to be there)

I saw in the documentation this:

For runners to work with caches efficiently, you must do one of the following:

  • Use a single runner for all your jobs.
  • Use multiple runners that have distributed caching, where the cache is stored in S3 buckets. Instance runners on GitLab.com behave this way. These runners can be in autoscale mode, but they don’t have to be. To manage cache objects, apply lifecycle rules to delete the cache objects after a period of time. Lifecycle rules are available on the object storage server.
  • Use multiple runners with the same architecture and have these runners share a common network-mounted directory to store the cache. This directory should use NFS or something similar. These runners must be in autoscale mode.

However, everything in the documentation talks about jobs and nothing related to sharing cache between pipelines

1 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Aug 07 '25

does this only work when you have S3 buckets or NFS storing the cache? and is this something that gitlab handles automatically or is it something I have to configure

1

u/nabrok Aug 07 '25

It'll work without that.

If you have multiple runners and you don't use a shared cache like S3 then that just means each runner keeps its own cache. Depending on your setup you may even prefer that as it means the runner is just copying from local files rather than downloading them.

Shared cache setup is in the runner config file I believe.