We set up Sonarcloud to start the code analysis when a pull request is sent through our already-existing Azure pipeline. The complete build took roughly 20 to 25 minutes with a success status prior to adding this sonar cloud task to the pipeline.
All of the pipelines were created using Azure DevOps (not on a separate virtual machine), and in addition to the solar cloud integrations, we have other integrations in our current pipelines.
After integrating this sonar into our Azure Cloud Pipelines, we are facing some issues:
Build time increased due to sonar cloud integration in our azure pipelines
It throws the error like “There is not enough space on the disk. Process ‘msbuild.exe’ exited with code ‘1’.” and it stops the build
From my observation, when the build time is below 45 minutes, it found it returns the success status. However, if the build time exceeds 45 minutes, it returns the failed status with the above error
We tried the exclusion techniques to reduce the number of files and folders. Even after this, we did not see improvement in built-time.
We want to find a solution to this soon. I want to know whether Sonarcloud is capable of working with Azure Pipelines.
I went through the troubleshooting ideas, and they are not suitable for the sonar cloud; please provide the steps for implementing them in the sonarcloud.
Most of the troubleshooting tips are about the configuration of the machine that is running the analysis. Which ones have you tried, and which ones do you think are not suitable for SonarCloud?
Your problems seem to be related to the resources of the build agents you are using i.e. disk space and execution time. It sounds like you are using the Microsoft-hosted build agents, so you won’t be able to directly modify the agent configuration to use a more powerful machine.
However, there are a number of things you can do:
increase the pipeline timeout. This is an hour by default for MS-hosted build agents but you can increase it. See the MS docs for more information.
split your pipeline into multiple stages, which will be executed on different build agents and run in parallel. Again, see the MS docs on stages for more information.
check there are no redundant steps in your pipeline.
Looking at the yaml file you provided, it looks like you are building all of the MSBuild solutions twice, first here:
avoid building everything twice. Instead, put the SonarCloudPrepare@1 and SonarCloudAnalyze@1 steps around the VSBuild@1 step, and drop the separate MSBuild@1 step.
If that doesn’t give the behaviour you want, you could try moving the SonarCloudPrepare@1, MSBuild@1, and SonarCloudAnalyze@1 steps to a separate stage so they can run in parallel on a separate machine.