Search code examples
azure-pipelinesazure-pipelines-tasks

Finding the right cache for PR build in context of Azure DevOps pipeline caching


I am trying to use the Azure DevOps pipeline caching mechanism like described here https://learn.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops but I am struggling to understand how for a PR build the cache is being searched for and in which order.

By definition the cache is always specific to the current pipeline and branch. But in this description it says that a PR build has read access to the cache from the target branch? How can I use the cache from the target branch? Is this done automatically by Azure pipelines? If so what is the order of branches where the cache is looked up: First current branch, then PR source branch, then PR target branch, etc ..?

Thank you in advance


Solution

  • I opened an issue on GitHub where the answer is given: https://github.com/microsoft/azure-pipelines-tasks/issues/17565

    Actually the order that is given in the official docs is followed. To get more information which cache scopes are checked the System.Debug variable can be set. Then it is visible in the logs.