I use the Sonar tasks in my Azure DevOps pipeline to run static analysis on my code, but I would like to avoid having the pipeline download the plugins everytime the pipeline runs.
I think I could use the Cache task but I'm not sure how should I configure it.
I was facing the same issue. My pipeline was downloading the Sonar plugins every time and taking about 40~60 seconds
.
I was able to cache the plugins through the .sonar/cache
folder and decrease the download time to around 8~12 seconds
.
Example:
variables:
SONAR_PLUGINS: /home/vsts/.sonar/cache
steps:
- task: Cache@2
inputs:
key: sonar | "$(Agent.OS)" | $(Build.Repository.Name)
path: $(SONAR_PLUGINS)
displayName: cache sonar plugins