SonarQube is able to send back QG status without webhook

Hi,

did you check the computing times of the background task for the jobs in question = no webhook added ?

the scanner workflow
After analysis is finished, the report archive is uploaded to Sonarqube server, you should see the
analysis id on the administration / background tasks page.

waitForQualityGate() does an initial call to Sonarqube server to see if the background task is already
done - if yes, there’s no need to wait for webhook.
You will see such entry in the Jenkins console log, status is SUCCESS or FAILED

Checking status of SonarQube task ‘XXXXXXXXXX’ on server ‘Sonar’
SonarQube task ‘XXXXXXXXXXXX’ status is ‘SUCCESS’

If the background task compution takes longer, Jenkins console has

SonarQube task ‘XXXXXXXXXX’ status is ‘PENDING’

means a listener is created waiting for the webhook with the related analysis id until the configured timeout strikes.

Guess the jobs in question have a short background task computing duration, so no webhook needed.
I’ve seen also cases of using a sleep before the waitForQualityGate() step, i.e. sleep 10
Using sleep increases the chances to camouflage a webhook problem - or no configured webhook -, as the initial call is delayed and the background task might be finished meanwhile.

To see what’s going on in Jenkins you should create a custom Jenkins Sonarqube logger
(/manage/log/new) with configuration logger hudson.plugins.sonar and org.sonarsource.

Gilbert

1 Like