Sonarqube Quality Gate is timing out in Jenkins - SonarQube task 'AKC-qLnO' status is 'PENDING'

We are facing this issues of the Pending status.
Under CE task we can see task shows that it only took a little over five seconds to complete, well within the 10 minute timeout that we increase from 3 minutes.

stage("SonarQube Quality Gate check") {
        //Force to fail step after specific time
        timeout(time: 10, unit: 'MINUTES')

CE status

    "status": "SUCCESS",
    "submittedAt": "2022-08-09T14:20:07+0000",
    "submitterLogin": "api-user",
    "startedAt": "2022-08-09T14:20:12+0000",
    "executedAt": "2022-08-09T14:20:18+0000",
    "executionTimeMs": 5384

Do we have any issues in jenkins plugin that sends the QG status check?

It is necessary to define a webhook in the sonarqube instance (if required what address should be, is it pointing to Jenkins server? or to sonrqube itself)

I also see suggestions from other folks faced the same issues to just add few seconds sleep between SQ analysis and QG check. Jenkins : waitForQualityGate function returns PENDING status and stays like that, even if the status is SUCCESS after 1 second (1) as they say it is an workaround and not a solution

Hey there.

Yes, you need to configure a webhook as noted in the documentation for the SonarScanner for Jenkins

Pre-requisites:

  • Configure a webhook in your SonarQube server pointing to <your Jenkins instance>/sonarqube-webhook/
  • Use withSonarQubeEnv step in your pipeline (so that SonarQube taskId is correctly attached to the pipeline context).

Okay… It looks like webhook was required and I am able to get the success result with less timeout defined in the jenkinsfile.

Thanks

1 Like