0

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

Marko
  • 929
  • 9
  • 27
  • According to this [document](https://learn.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops#cache-isolation-and-security), the cache for the Pull request runs is to ensure isolation between caches from different pipelines and different branches. May I know why you want to use the cache from `Target branch`? If you would expect to use the code from `Target branch`, you may consider [checking out multiple repositories in your pipeline](https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops). – Alvin Zhao-MSFT Jan 04 '23 at 09:02
  • It is not that I need to do that but in my case it would help though to use the cache from the target branch as fall back if there is none from the current branch. But in general I want to understand the caching concept and its related documentation. – Marko Jan 04 '23 at 14:24
  • Indeed, it does not give us any sample of this usage in this document. Per the concern related to the document, [create a new issue](https://github.com/microsoft/azure-pipelines-tasks/issues/new?labels=Area%3A%20PipelineCaching) with the author and provide the necessary information about your scenario. – Alvin Zhao-MSFT Jan 05 '23 at 08:02
  • Glad to know that the information shared in GitHub issue resolved your concerns. At your convenience, would you accept the information that you shared below as the answer to this question, which may help other users who have similar concerns. Thanks for the amicable sharing. – Alvin Zhao-MSFT Jan 12 '23 at 06:10

1 Answers1

0

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.

Marko
  • 929
  • 9
  • 27