-
Notifications
You must be signed in to change notification settings - Fork 141
Quality Gate status badges
In order to generate a badge that displays the quality gate status of a project or view analysed by your SonarQube instance, call the following REST webservice:
/api/badges/gate?key=<project or view key>
Depending on the project's status and SonarQube configuration, one of the following image types will be generated :
- Passing indicates that the project passes the quality gate (QG)
- Warning indicates that the project does not pass the quality gate due to QG warnings
- Failing indicates that the project does not pass the quality gate due to QG errors
- No Gate indicates that no quality gate has been set for the specified project
- Not Found indicates that the project / view could not be found
Here is a live badge for the current quality gate status of the SVG Badges plugin on SonarQube.com:
By default, the plugin generates badges with rounded corners. If you want to generate flat badges instead, add the optional parameter template
with value FLAT
as follows:
/api/badges/gate?key=<project or view key>&template=FLAT
(requires version 3.0.0
.)
If you want the badge to be blinking if the quality gate is in ERROR
status, add the optional parameter blinking
with value true
as follows:
/api/badges/gate?key=<project or view key>&blinking=true
(requires version 3.0.0
.)
You can display Quality Gate badges using HTML or Markdown as follows.
Note 1: The plugin is currently installed on SonarQube.com public instance. If you want to display a badge for a project analyzed on SonarQube.com, just use https://sonarqube.com
as <serverBaseURL>
.
<a href="<serverBaseURL>/dashboard/index/<project or view key>"><img src="<serverBaseURL>/api/badges/gate?key=<project or view key>"/></a>
Example:
<a href="http://localhost:9000/dashboard/index/com.qualinsight.plugins.sonarqube:qualinsight-plugins-sonarqube-badges"><img src="http://localhost:9000/api/badges/gate?key=com.qualinsight.plugins.sonarqube:qualinsight-plugins-sonarqube-badges"/></a>
[](<serverBaseURL>/dashboard/index/<project or view key>)
Example:
[](http://localhost:9000/dashboard/index/com.qualinsight.plugins.sonarqube:qualinsight-plugins-sonarqube-badges)