Search code examples
amazon-web-servicessonarqubebitbucketsonarqube-scanaws-codepipeline

How to get SonarQube results back to CodeBuild


I've seen many discussions on-line about Sonar web-hooks to send scan results to Jenkins, but as a CodePipeline acolyte, I could use some basic help with the steps to supply Sonar scan results (e.g., quality-gate pass/fail status) to the pipeline.
Is the Sonar web-hook the right way to go, or is it possible to use Sonar's API to fetch the status of a scan for a given code-project? Our code is in BitBucket. I'm working with the AWS admin who will create the CodePipeline that fires when code is attempted to be pushed into the repo. sonar-scanner will be run, and then we'd like the pipeline to stop if the quality does not pass the Quality Gate.

If I would use a Sonar web-hook, I imagine the value for host would be, what, the AWS instance running the CodeBuild?

Any pointers, references, examples welcome.


Solution

  • I created a powershell to use with Azure DevOps, that possible may be migrated to some shell script that runs in the code build activity

    https://github.com/michaelcostabr/SonarQubeBuildBreaker