question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable fallback keys (multiple restore keys) in Pipeline Caching

See original GitHub issue

Right 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:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

12reactions
adrian-skybakercommented, Jul 22, 2020

Yup, we will be updating the docs soon. 😃

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?

4reactions
fadnavistanmaycommented, Oct 9, 2019

Yup, we will be updating the docs soon. 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found