Jumping on an old thread but I have the same need using docker based 
agents.  I was thinking of trying to write a cache plugin that achieves a 
similar caching capability that travis ci provides for arbitrary 
directories : https://docs.travis-ci.com/user/caching/#Arbitrary-directories

In the pipeline code, there would be a cache build wrapper that would 
download the cache from the master when entering the block and when the 
block completed, save the specified paths back to the master (ideally in an 
rsync style way with minimal data movement).  There would also be a maximum 
cache size so that when the cache grew too large, it would be deleted from 
the master and started fresh on the next run:

node {
  cache ([maxSize="250M", 
     paths=[
        [path="${HOME}/.gradle/cache", 
           excludes=["${HOME}/.gradle/caches/modules-2/modules-2.lock", 
"${HOME}/.gradle/caches/*/plugin-resolution"]],
        [path="${HOME}/.gradle/wrapper"]
     ]
  ]) {
     sh './gradlew build -s'
  }
}

Anyone aware of anything like this?

Thanks,
Pete

On Thursday, June 23, 2016 at 3:00:56 AM UTC-4, Marco Pas wrote:
>
> I was hoping that these dependencies could be cached somewhere in the 
> workspace instead or relying on Gradle specific things. We have the same 
> thing for NPM related dependencies. Continuous downloading of the related 
> dependencies is just to slow.
>
> On Thursday, June 23, 2016 at 8:48:32 AM UTC+2, Craig Rodrigues wrote:
>>
>> In 2011, this discussion thread talked about this topic: 
>> https://discuss.gradle.org/t/cache-dependencies-into-local-maven-repository-from-gradle/7525
>>  
>> and it didn't seem possible.
>>
>> However, I advise you to post your question to 
>> https://discuss.gradle.org/ , because there may be new information that 
>> can make this possible.
>>
>> --
>> Craig
>>
>>
>> On Wed, Jun 22, 2016 at 4:48 AM, Marco Pas <[email protected]> wrote:
>>
>>> Now that we have a first successful build using a Jenkinsfile Pipeline 
>>> we are looking on how to cache downloaded dependencies.
>>> Currently when we build our Gradle applications the dependencies are 
>>> downloaded each time the Docker Slave is executed on a remote host. Is 
>>> there a way to cache the downloaded dependencies for later reuse so we can 
>>> speedup the build process?
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fa122935-5293-404b-9ddd-d6ca29002b70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to