Hi there
I’m struggling to get the waitForQualityGate to work and I think it’s a connection issue.
Jenkins server version 2.138.3
Jenkins Sonarqube Scanner plugin version 2.8
SonarQube Server Version 8.3.1.34397
Jenkins Pipeline Code
stage(“Sonar Scan”) {
steps {
script {
withSonarQubeEnv(‘Sonar’) {
sh “${scannerHome}/bin/sonar-scanner -X -Dproject.settings=sonar.properties -Dsonar.login=${SONAR_AUTH_TOKEN} -Dsonar.host.url=${SONAR_HOST_URL}”
}
}
}
}
stage (“Sonar Quality Gate”) {
steps {
timeout(time: 1, unit: ‘MINUTES’) {
waitForQualityGate abortPipeline: true
}
}
}
Jenkins output
Checking status of SonarQube task ‘AXNXBU3IelPMiWk7pwJG’ on server ‘Sonar’
SonarQube task ‘AXNXBU3IelPMiWk7pwJG’ status is ‘IN_PROGRESS’
Cancelling nested steps due to timeout
Timeout has been exceeded
Finished: ABORTED
Project Level Webhook
URL http://[jenkinsurl]:[jenkinsport]/sonarqube-webhook/
No secret
Project Level Webhook Output
Response: 403
Duration: 6ms
Payload:
{
“serverUrl”: “http://localhost:9000”,
“taskId”: “AXNXBU3IelPMiWk7pwJG”,
“status”: “SUCCESS”,
“analysedAt”: “2020-07-16T09:46:48+0000”,
“revision”: “061568d39829d058dc86dd67a936f3cd533d7806”,
“changedAt”: “2020-07-16T09:46:48+0000”,
“project”: {
“key”: “[project key]”,
“name”: “[project name]”,
“url”: “http://localhost:9000/dashboard?id=[project id]”
},
“branch”: {
“name”: “master”,
“type”: “BRANCH”,
“isMain”: true,
“url”: “http://localhost:9000/dashboard?id=[project id]”
},
“qualityGate”: {
“name”: “SonarQube Gate [project name]”,
“status”: “OK”,
“conditions”: [
{
“metric”: “new_reliability_rating”,
“operator”: “GREATER_THAN”,
“value”: “1”,
“status”: “OK”,
“errorThreshold”: “1”
},
{
“metric”: “new_maintainability_rating”,
“operator”: “GREATER_THAN”,
“value”: “1”,
“status”: “OK”,
“errorThreshold”: “1”
}
]
},
“properties”: {}
}
I think the issue is the connection from the sonarqube server back to the jenkins server.
As you can see above, the quality gate passes, so I would have expected the job to not abort.
Does anyone know how I’d setup a logger in jenkins to catch any information coming from the sonarqube server, or have any other ideas on how I could debug the issue?
Thanks in advance for all your help.