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
at org.eclipse.jgit.util.FileUtils.mkdirs(FileUtils.java:412)
at org.eclipse.jgit.internal.storage.file.LockFile.lock(LockFile.java:130)
at org.eclipse.jgit.storage.file.FileBasedConfig.save(FileBasedConfig.java:219)
at org.eclipse.jgit.util.FS$FileStoreAttributes.saveToConfig(FS.java:740)
at org.eclipse.jgit.util.FS$FileStoreAttributes.lambda$4(FS.java:426)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
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:
1.
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'sonarcloud.io'
organization: 'xxxx'
scannerMode: 'CLI'
configMode: 'file'
cliProjectKey: 'xxxx-retail'
cliProjectName: 'xxxx :: Retail'
cliSources: '$(System.DefaultWorkingDirectory)'
enabled: true
- task: SonarCloudAnalyze@1
enabled: true
- task: SonarCloudPublish@1
enabled: true # turn this back on when portal based one is removed
inputs:
pollingTimeoutSec: '300'
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.
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?