We are attempting to run the sonarcloud scans in our DevOps Pipelines on a self-hosted Azure Agent, as opposed to an Azure-hosted agent. This all works perfectly fine on the Azure-hosted agent, but we keep getting an error on the self-hosted.
The error occurs during the “SonarCloudAnalyze@1” task in our yaml pipeline.
INFO: Load metrics repository (done) | time=675ms
##[error]ERROR: Cannot save config file 'FileBasedConfig[/home/vsts/.config/jgit/config]'
java.io.IOException: Creating directories for /home/vsts/.config/jgit failed
The issues seems to be that the “vsts” path only exists on Azure-hosted Agents, but I cannot find any documentation on how to specify a different, working path. The output for other tasks appears to go an “agent” path: “TypeScript configuration file /agent/_work/1/s/…”.
I’ve searched, and seen similar topics, but none that seem to apply directly. Any help would be greatly appreciated.
I was not able to reproduce your issue, could you please give me more details about your project, what is the language? Could you also share your yaml config file?
Hello and thanks for your reply.
The trouble with reproducing it is that it works fine in a pipeline running on an Azure Hosted agent. It’s only when I switch to self-hosted that we get the error.
The project language is Angular TS.
The config is:
- task: SonarCloudPrepare@1
cliProjectName: 'xxxx :: Retail'
- task: SonarCloudAnalyze@1
- task: SonarCloudPublish@1
enabled: true # turn this back on when portal based one is removed
Few more information I need:
- What is the OS system of the self-hosted agent you are using?
- Could you please send me the full scanner logs from a failing analysis and a successful analysis so I can compare them? You can run scanner with -x to get more detailed logs. And I can start a private channel if you want to share them privately.
Thanks a lot
Both agents have Ubuntu as the OS.
I’m using the built-in ADO task, does the “-x” work with that or would I need to script it differently?
- task: SonarCloudAnalyze@1
I’d be happy to provide the logs in a private channel. Thanks again for your help.
You can add the following code at the beginning of you yaml file to enable debugging logs:
- name: system.debug
It will add debug to all tasks so your pipeline will take longer to execute.
I will start a private conversation so you can share your logs.
Good News! We were able to resolve the error by creating the “vsts” path on the self-hosted agent, under home, and then granting Read/Write access to that path.
So my issue appears to be fixed, but I’m still curious why that vsts path was chosen, or where it came from. Is that a path that could be adjusted with parameters?
Great news. Thanks a lot for sharing. Unfortunately, the path is not something adjustable.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.