Drillster / drone-volume-cache

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

Add support for caching between builds #12

Closed MOZGIII closed 6 years ago

MOZGIII commented 7 years ago

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

mjwwit commented 7 years ago

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.

MOZGIII commented 7 years ago

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.

mjwwit commented 7 years ago

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