Docker equivalent of SonarCloudPublish@1 task?

We have successfully used SonarCloud, integrated with repositories on Azure Devops. We also managed to get PR integration working, using SonarQube/SonarCloud Azure Pipelines Extension. This works great when building on the buildhost itself. Quality gates are submitted using SonarCloudPublish@1 task.

Because most of our projects build within docker, we want to meet the requirement to run sonarscanner within docker build layers. So we created a dockerfile that installs and uses the dotnet-sonarscanner, which works and results show up on sonarcloud dashboard. However, quality gates are not submitted back to azure devops.

We have not found the equivalent cli shell command for SonarCloudPublish@1 task, which we can incorporate in our dockerfile. Are you aware of a working solution for our situation?


Welcome to the community!

Well… that’s because there’s not one. At the CLI level, it’s a question of configuring a webhook, catching the call, parsing the result and then doing something with the data. And that assumes you can just pause until the webhook comes back - it’s not immediate after the end of analysis. Your other option is to go old-style and cycle on checking the server for completion of the analysis report processing and sleeping if it’s not done yet.