Drillster/drone-volume-cache

Add support for caching between builds

Closed this issue · 3 comments

Right now cache key is $DRONE_JOB_NUMBER.
Can we add the ability to use branch as a cache key instead?

Maybe we should make it completely configurable (with sensible defaults). I imagine a situation like:

pipeline:
  restore-cache:
    image: drillster/drone-volume-cache
    restore: true
    mount:
      - ./node_modules
    volumes:
      - /tmp/cache:/cache
+   cache_key: [ BRANCH, JOB_NUMBER ]

Which would result in:
/cache/$DRONE_REPO_OWNER/$DRONE_REPO_NAME/$DRONE_BRANCH/$DRONE_JOB_NUMBER

Are you comfortable with some bash scripting? If so you could try and make a PR. If not, I'll work on it when I get around to it.

Yes, I like the idea.
I can do bash, but I won't be able to get into it soon (probably I'll do it in our next CI optimization pass), so I'd propose you do it if you want to.

Alrighty, I'll add it to our backlog then.