drone-cache
drone-cache copied to clipboard
If one of the mounted folder not exists, rebuild will failed.
I will do unit test on feature branch & master branch, and e2e test only for master branch.
For unit test, I need to run composer install
, it will generate vendor/*
For e2e test, I need to run npm install
, it will generate node_modules/*
I want to cache this two folders, vendor & node_modules
However, if it is a feature branch commit, it wont run e2e test, so there will be no node_modules to cache.
And the final rebuild cache step will failed.
My local folder /tmp/cache
will still empty after rebuild.

Here is my example .drone.yml
- name: restore-cache
pull: if-not-exists
image: meltwater/drone-cache
volumes:
- name: cache
path: /tmp/cache
settings:
backend: filesystem
restore: true
cache_key: volume
archive_format: gzip
mount:
- vendor
- node_modules
- name: unitTest
image: php
commands:
- composer install
- ./vendor/bin/phpunit
when:
branch:
- feature/*
- master
- name: e2eTest
image: node
commands:
- npm install
- npm run test
when:
branch:
- master
- name: rebuild-cache
pull: if-not-exists
image: meltwater/drone-cache
volumes:
- name: cache
path: /tmp/cache
settings:
backend: filesystem
rebuild: true
cache_key: volume
archive_format: gzip
mount:
- vendor
- node_modules
volumes:
- name: cache
host:
path: /tmp/cache
Hi @wagaru I have the same issue
@wagaru @framled Just to make sure that I understood you correctly. If one of the given two paths is NOT accessible, you still want task to succeed?
We can consider this as improvement, we have a similar issue to create separate archives for each given path. That being said, this is easily solvable by separating caching task per path if the given path is optional.
@wagaru @framled Just to make sure that I understood you correctly. If one of the given two paths is NOT accessible, you still want task to succeed?
We can consider this as improvement, we have a similar issue to create separate archives for each given path. That being said, this is easily solvable by separating caching task per path if the given path is optional.
In my case, yes! The task should be successed, and still have the cache for exists folder.