it's because cache key is identified by runner-id, 162eb344 in this example:
Downloading cache.zip from http://minio-s3:9000/runner/runner/162eb344/project/133/ci-tools
I have runners configured in docker-compose with REGISTRATION_TOKEN env configured, so scale=3 would create 3 runners
but they each have different runner id.
I could hack this and setup CI_SERVER_TOKEN=162eb344....... for each runner, this will work, they will all pull same cache (by 162eb344),
but it's definately hack, because all the runners submit under same "runner" in gitlab admin page, whoever they are really 3 different runners.
Proposal
add S3_CACHE_ID or S3_CACHE_DIR variable that all runners can share to identify they wish to share cache.
Designs
Child items
...
Show closed items
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
I believe you can set the cache key value, isnit ?
The key directive allows you to define the affinity of caching between jobs, allowing to have a single cache for all jobs, cache per-job, cache per-branch or any other way you deem proper.
This allows you to fine tune caching, allowing you to cache data between different jobs or even different branches.
@glensc setting up the cache sometimes can be confusing.
We have the cache from the perspective of the developers (who consumes a cache within the build) and the cache from the perspective of the runner.
Depending on which type of runner you are using, it can act differently. For example, in gitlab.com we use autoscaling runner, which can use an external S3 service to store your cache.
For the autoscaler runner, the cache key you define in gitlab-ci.yml is unique for the project. So during a single pipeline run (of one or multiple jobs), whoever uses the same cache key will get access to the same data, but they can't "share" in the same run data with each other (like a shared / networked folder).
@brodock i'm using static docker runner with S3 configured as cache backend. (all on promise installations: gitlab-ce, gitlab-ci-multi-runner, minio). i can scale it manually with docker-compose scale runners=3, which would just create 2 more docker containers on the same node.
i've already identified why the cache is not shared between runners and proposed solution. it's described in issue initial description.
if i do not use S3 cache backend i do understand that each docker runner runs it's own container and cache is just the docker volume. however S3 makes it possible to share cache with the runners as i've already outlined in issue initial description.
my problem is not in .gitlab-ci.yml level, but runner level that runners can't share cache. actually in my installation they do share cache via the hack i described.
as for the projects sharing cache, it is already unique in the url, in the example i gave: project/133. so that part is okay, projects can't steal each-one's cache.
@glensc I guess you are right.
@ayufan please correct me if I'm wrong but the S3 cache was designed mostly with the autoscaler in mind.
Trying to use it with isolated, manually defined runners, probably will shard the caches with the runner-id. It makes sense to be able to share cache with manually bootstraped runners overriding the path somehow.
@brodock can you show your cache path used by docker+machine setup for comparison? i think you need to enable runner DEBUG option to see used cache urls.
Shared to drop runner/<runner> from the generated path, by default set to false.
To generate a path:
- if shared: http://<s3-server>/<path>/project/<id>/<cache-key>- if not shared: http://<s3-server>/<path>/runner/<runner-token>/project/<id>/<cache-key>