Background: Pipeline caching allows one to store a folder and re-use it on the next build, given that some keys, branches and whatnot matches. Useful for node_modules, nuget packages and Git LFS, but also for builds
I can't find anything in the Pipeline Caching docs for this.
I want to save the cache even if the build fails, for incremental builds or Git LFS checkouts, such as the following scenario:
- new feature branch checked in
- a big refactor, thus many changes
- a few tests fail, so cache is not stored
- fixing them are trivial, and require small recompile, but the entire build needs to be re-run the entire pipeline failed.
The example list something like this:
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: Cache Yarn packages
But it only ever caches if the entire pipeline succeeds.