Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If one of the mounted folder not exists, rebuild will failed. #134

Open
wagaru opened this issue Jul 21, 2020 · 3 comments
Open

If one of the mounted folder not exists, rebuild will failed. #134

wagaru opened this issue Jul 21, 2020 · 3 comments

Comments

@wagaru
Copy link

wagaru commented Jul 21, 2020

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.

螢幕快照 2020-07-21 上午11 02 14

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
@framled
Copy link

framled commented Jul 21, 2020

Hi @wagaru I have the same issue

@kakkoyun
Copy link
Contributor

@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
Copy link
Author

wagaru commented Jul 31, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants