Drillster / drone-volume-cache

Drone plugin for caching to a locally mounted volume
MIT License
109 stars 42 forks source link

Caching on branches and pull requests #13

Closed Rush closed 6 years ago

Rush commented 6 years ago

Hello, I read an article on how caching worked for Drone 0.4 http://readme.drone.io/0.4/usage/caching/

Does this plugin work the same? I am particularly interested in the below:

Branches and Matrix

Drone keeps a separate cache for each Branch and Matrix combination. Let’s say, for example, you are using matrix builds to test node 0.11.x and node 0.12.x and you are caching node_modules. Drone will separately cache node_modules for each version of node.

Pull Requests

Pull requests have read-only access to the cache. This means pull requests are not permitted to re-build the cache. This is done for security and stability purposes, to prevent a pull request from corrupting your cache.

mjwwit commented 6 years ago

Technically speaking, this plugin is very similar to the caching in Drone 0.4. The plugin caches folder on a mounted host directory, meaning it works well for single machine situations.

The plugin has a separate cache for Matrix jobs, but not for branches. This has been requested in #12. I like the idea of making Pull Request access read only. I will add it to the list.

Rush commented 6 years ago

https://github.com/Drillster/drone-volume-cache/pull/16 - not sure if this is what you planned but I don't mind pull requests having write access to cache.

One thing to keep in mind though is that some sort of cache cleanup needs to happen periodically. Maybe this cleanup should be added to the plugin itself. For example limiting cache size and cleaning oldest caches when a threshold is reached.

Rush commented 6 years ago

My branch can be tested with rushpl/drone-volume-cache, same config, should work automatically

mjwwit commented 6 years ago

The cache cleanup function is actually already present. You can set a cache TTL like so: https://github.com/Drillster/drone-volume-cache/blob/master/DOCS.md#using-cache-lifetime