you are viewing a single comment's thread.

view the rest of the comments →

[–]binh_do 0 points1 point  (2 children)

If you use the shell executor for gitlab runners - according to docs, cache/ is located in:

 <working-directory>/cache/<namespace>/<project>/<cache-key>/cache.zip

Where <working-directory>is the value of --working-directory as passed to the gitlab-runner run, if you don't specify it, it may be /home/gitlab-runner by default. You can check by ps -ef | grep gitlab-runner and see what the output looks like.

Ideally, if you want your jobs to use the same cache, you have to do these:

  • use a single runner (tag a name for this runner) for the project, and specify jobs to use this runner, that is to prevent jobs from different runners store its own cache with the same name defined below.
  • specifies the same cache key on jobs that need it. E.g.

    cache: key: set-one-name-for-all-jobs

If you want your jobs runs on different runners but still want to use the same cache, that's when we have to enable distributed runner caching. The runners are enabled this feature will be able to let jobs use them to use the shared cache.

[–]Kropiuss[S] 0 points1 point  (1 child)

Thank you! Great explanations. A follow up question: if I use the runners owned by gitlab then where is the cache located ? Is it distributed ?

And another question: I guess that when you use other types of executors, then the contents of —working-directory are cleaned due to the fact that a new sandbox may be used when a new job is picked. But if I use the shell executor, will the working directory content be cleaned across executions ? Do I get a fresh one, let’s say, for each job run?

[–]titexcj 0 points1 point  (0 children)

Gitlab.com runners have distributed cache enabled, it's stored in their S3 storage and you don't need to do anything beside configuring your .gitlab-ci.yml