SonarQube version: 6.7.2.37468
- what are you trying to achieve = Quality gate response of ‘OK’
- what have you tried so far to achieve this
We have created a custom quality gate with only one rule: new vulnerabilities is greater than error=0
The Jenkins multi-branch build pipeline runs a system function to get quality gate status and it is always returning ERROR. There are no new vulnerabilities in the master or develop branch and the sonarqube report does not list any reasons for the gate failure.
develop branch shows red dot, but no new vulnerabilities:
Jenkins response:
[Pipeline] waitForQualityGate
15:51:58 Checking status of SonarQube task ‘AW4Zt6yvx-RjNMVPHSNL’ on server ‘CDG-SonarQube’
15:51:58 SonarQube task ‘AW4Zt6yvx-RjNMVPHSNL’ status is ‘SUCCESS’
15:51:58 SonarQube task ‘AW4Zt6yvx-RjNMVPHSNL’ completed. Quality gate is ‘ERROR’
Groovy code:
def qg = waitForQualityGate()
if (qg.status != ‘OK’) {
if (skipFailure) {
println “WARNING! Should be failing build as quality gate is: {qg} but continuing.."
} else {
failBuild("Execution failed due to quality gate failure: {qg.status}”)
}
}
println “Quality gate status is: ${qg.status}”
Why the error response when the only rule in the quality gate is not violated?
Also when I run an API status check it returns OK:
/api/qualitygates/project_status?projectKey=ScreenReviews.sln
response:
{“projectStatus”:{“status”:“OK”,“conditions”:,“periods”:[{“index”:1,“mode”:“previous_version”,“date”:“2018-06-13T12:18:24-0700”,“parameter”:“1.134”}],“ignoredConditions”:false}}
I presume status and quality gate are different metrics?
Is there some other report or log I can review to determine what exactly is failing the quality gate?
thanks for your help.