Submit Your Ideas

We want to hear from you - vote for the features and improvements you'd most like to see, or submit your own ideas if you don't find them already listed.

Add support for saving cache under multiple keys in one stanza

At the moment, I'm saving cache on the same directory multiple times:

 

 - save_cache:
key: dot-stack-{{ checksum "resolver.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw
paths: ~/.stack
- save_cache:
key: dot-stack-{{ checksum "ghc-version.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw
paths: ~/.stack
- save_cache:
key: dot-stack-{{ checksum "resolver.conf" }}-build-gz8vvsw
paths: ~/.stack
- save_cache:
key: dot-stack-{{ checksum "ghc-version.conf" }}-build-gz8vvsw
paths: ~/.stack
- save_cache:
key: dot-stack-work-{{ checksum "resolver.conf" }}-gz8vvsw
paths: ~/project/.stack-work

 

I do this because when I restore the cache, I attempt to restore from the same keys in reverse.  This allows me to pick the *best* cache, defined as the cache that is most likely to require the least amount of rebuilding and gracefully fallback to a not as good cache.

Unfortunately, when I do this, Circle CI counts each save as a separate upload.

See here: https://circleci.com/gh/haskell-works/hw-dsv/190

It ought to be possible to upload the cache once and give it multiple keys:

 


- save_cache:
keys:
- dot-stack-{{ checksum "resolver.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw
- dot-stack-{{ checksum "ghc-version.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw
- dot-stack-{{ checksum "resolver.conf" }}-build-gz8vvsw
- dot-stack-{{ checksum "ghc-version.conf" }}-build-gz8vvsw
paths: ~/.stack
- save_cache:
key: dot-stack-work-{{ checksum "resolver.conf" }}-gz8vvsw
paths: ~/project/.stack-work
  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Jun 1 2018
  • Future consideration
  • Attach files