Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
SonarQube Quality Gates Task Plugin
- Download gocd-sonarqube-qualitygates-plugin
- Copy it to Go.CD server plugin external folder (path to go-server/plugins/external)
- Restart go-server service.
Define a quality gate in SonarQube
A SonarQube scan has to be already configured for your project. You can use sonar-runner or maven, gradle, msbuild plugins provided by SonarQube for scanning your project. See analyzing source code in SonarQube documentation for details.
Connect a quality gate with your project
On your SonarQube server go to "Quality Gates" and add your project to a Quality Gate. You can use the predefined "SonarQube way" quality gate or you can define your own rules.
Test your quality gate
After configuring a quality gate for your project run a SonarQube scan on your project. After completion, you will see a quality gate result on the dashboard of your project. (see red box on the screen)
Add and configure a task in your pipeline
Add the SonarQube Quality Gates task to your pipeline
Select "SonarQube - Quality Gate" from add task drop down list.
Configure your task
Enter the project key of your SonarQube project in the task configuration. Your SonarQube project key is displayed at the bottom of your SonarQube project dashboard.
Select if the task will fail on a quality gate warning or error. If there is no quality gate defined for your project, the task will also fail and stop your pipeline. Save the task config and run your pipeline.