Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cache downloaded dependencies for a Jenkins Docker SSH Slave (Gradle)

We have Jenkins Docker Slave template that successfully builds a piece of software for example a Gradle project. This is based on the https://hub.docker.com/r/evarga/jenkins-slave/).

When we fire up the docker slave the dependencies are downloaded everytime we do a build. We would like to speed up the build so dependencies that are downloaded can be reused by the same build or even by other builds.

Is there a way to specify an external folder so that cache is used? Or another solution that reuses the same cache?

like image 362
Marco Avatar asked Jun 23 '16 09:06

Marco


1 Answers

I think, the described answers work only for exclusive caches for every build-job. If I have different jenkins-jobs running on docker-slaves, I will get some trouble with this scenario. If the jobs run on the same time and write to the same mounted cache in the host-filesystem, it can become corrupted. Or you must mount a folder with the job-name as part of the filesystem-path (one jenkins-job run only once at a time).

like image 176
afischer Avatar answered Oct 07 '22 08:10

afischer