Enable fallback keys (multiple restore keys) in Pipeline Caching
See original GitHub issueRight now, a Pipeline Caching entry lookup can either be an exact hit or otherwise it is a miss. This can help with many scenarios, but is less effective for others.
Here’s my thinking on how we expand from that:
On saving a cache entry, it will continue to be stored at a specific key with an immutable value, however, one will be able to query it with multiple exact keys or key prefixes. Here’s an example:
variables:
BUILD_KIT_CACHE: '$(Pipeline.Workspace)/buildkitcache'
steps:
cache:
path: $(System.DefaultWorkingDirectory)/buildkit
key:
- $(Build.SourceVersion)
$(Build.SourceBranch)
$(System.DefinitionId)
fallbackKeys:
- $(Build.SourceBranch)
$(System.DefinitionId)
- $(System.DefinitionId)
For saving, the cache entry will be stored at this “path”:
$(System.DefinitionId)/$(Build.SourceBranch)/$(Build.SourceVersion)
Lookups will occur in the following order until an entry is found. Should a particular lookup return multiple entries, the one that was most recently created will be selected.
First lookup: $(System.DefinitionId)/$(Build.SourceBranch)/$(Build.SourceVersion)
Second lookup: $(System.DefinitionId)/$(Build.SourceBranch)/**
Third lookup: $(System.DefinitionId)/**
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Pipeline caching - Azure - Microsoft Learn
restoreKeys can be used if one wants to query against multiple exact keys or key prefixes. This is used to fall back to...
Read more >Caching in GitLab CI/CD
If multiple caches are combined with a fallback cache key, the fallback cache is fetched every time a cache is not found. Use...
Read more >Azure: Pipeline caching. In late 2019, Azure DevOps finally…
In late 2019, Azure DevOps finally released a feature to enable caching on pipelines. Pipeline caching on other platforms like AWS, ...
Read more >Caching Dependencies - CircleCI
This document is a guide to caching dependencies in CircleCI pipelines. ... CircleCI restores caches in the order of keys listed in the...
Read more >How to REDUCE Build Time Using Caching in Azure Pipelines
There is also another parameter, "restore keys", which can be used if you want to query against multiple keys or key prefixes. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That was nearly 10 months ago. Perhaps you could leave github issues open until the documentation is done? Otherwise it seems documentation never actually happens? And without it are they really completed features?
Yup, we will be updating the docs soon. 😃