SonarQube Cloud | Advanced setup | CI-based analysis | Jenkins | Key features
Key features of the SonarQube Cloud integration with Jenkins
SonarSource provides an extension for Jenkins to enable smooth integration with Jenkins. With the Jenkins Extension for SonarQube Cloud:
- You can install the SonarScanner CLI, for Maven, for Gradle, or for .NET from Jenkins and centralize the configuration of SonarQube Cloud connection details in Jenkins global configuration.
- You can trigger the SonarQube Cloud analysis from your Jenkins Freestyle or Pipeline jobs using standard Jenkins build steps or Jenkins Pipeline DSL. Once the Jenkins job is complete, the extension will detect that a SonarQube Cloud analysis was made during the build and display a badge and a widget on the job page with a link to the SonarQube Cloud dashboard as well as quality gate status.
- Starting in Team plan, you can configure an automatic failing of your pipeline in case your code fails the quality gate you defined in SonarQube Cloud: see below.
Automatic interruption of your pipeline in case the quality gate fails
This feature is available starting in Team plan.
With the Jenkins Extension for SonarQube Cloud, you can configure that your pipeline job fails in case the quality gate computed by SonarQube Cloud for your project fails. To do so, the extension makes webhook available: a webhook call must be configured in SonarQube Cloud to call back into Jenkins to allow the pipeline to continue or fail.
The figure below illustrates the process:
- A Jenkins Pipeline job is started.
- The job triggers the analysis by the SonarScanner.
- The SonarScanner sends the results to SonarQube Cloud.
- SonarQube Cloud completes the analysis, computes the quality gate configured for the project, and checks if the project fails or passes the quality gate.
- SonarQube Cloud sends the pass or failure result back to the Jenkins webhook exposed by the extension.
- The pipeline job continues (in case of a pass) or fails (otherwise).
Related links
Was this page helpful?