Gradle depencies cache -- /cache on runner [SOLVED]


I’m trying to setup a shared cache for all jobs/pipelines. I know that the /cache directory is always present (it’s the default) in the config.toml config file. I expect this to mean that the /cache-directory will cache ci files according to .gitlab-ci.yml-file.

In my .gitlab-ci.yml file:


  - chmod +x gradlew
  - export GRADLE_USER_HOME=/cache/.gradle

    - $GRADLE_USER_HOME/caches/
    - $GRADLE_USER_HOME/wrapper/
    - $GRADLE_USER_HOME/build-cache/

I expect that all gradle dependencies will be cached on the runner in the /cache/.gradle-directory. If the runner caches the files there, I expect the /cache directory to be present on the runner… However, there is no /cache directory on the runner. Also, caching between jobs/pipeline doesn’t work (everything is always downloaded over and over again… .

Am I supposed to create the /cache directory myself? Which permissions? …?
Or how can I setup caching of gradle (or npm, or …) dependencies on the runner, so that they are not downloaded over and over again?


added deps to a custom CI docker container…