I have a kubernetes cluster with a gitlab-runner 10.3.0 and kubernetes executor. There is no cache_dir
defined in the runner’s config.toml-file.
In a .gitlab-ci.yml
, I configured a job to use the cache:
build:
cache:
key: "${PROJECT_NAME}"
paths:
- "node_modules/"
script:
- ls node_modules/ || echo "cache not there"
- npm i
- npm build
- ...
When I run this, I see the cache being pulled and created:
Cloning repository for some-branch with git depth set to 1...
Cloning into '/group/projectname'...
Checking out d03baa31 as some-branch...
Skipping Git submodules setup
Checking cache for projectname...
Successfully extracted cache
$ docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
//
// ...work being done here...
//
Creating cache projectname...
node_modules/: found 24278 matching files
Created cache
Job succeeded
However, when I push another commit to this branch, the ls node_modules/
still does not find the cache.
I searched the documentation and did not find any information on how to activate the cache. The gitlab-runner-pod does not have any of the supposedly cached files there as well and according to the documentation, a cache_dir
in the config is not used by the kubernetes executor.
But according to this feature page, the kubernetes executor does support cache.
So how to do this?