Jenkins pipeline method "waitForQualityGate()" hangs

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube 9.9.0-enterprise, Jenkins version ,plugins version )
  • how is SonarQube deployed: Docker
  • what are you trying to achieve
    pause pipeline until qualityGate completes
  • what have you tried so far to achieve this
    // Make sure analysis is finished before getting results
    counter = 0; maxCount = 5
    def qg
    while (counter < maxCount) {
        counter++
        try {
            withSonarQubeEnv('SonarQube Server') {
               qg = waitForQualityGate abortPipeline: false
               println "Quality Gate status is " + qg.status + " at iteration " + counter.toString()
            }
        if (qg.status == 'OK') break
        }
        catch (Exception e) {
            println 'Error waiting for Sonarqube analysis to complete - exception ' + e + ', Ignoring.'
        }
    }

Job hangs after printing:

[Pipeline] withSonarQubeEnv
12:54:38  Injecting SonarQube environment variables using the configuration: SonarQube Server
[Pipeline] {
[Pipeline] waitForQualityGate
[Pipeline] }
[Pipeline] // withSonarQubeEnv
[Pipeline] echo
12:54:38  Error waiting for Sonarqube analysis to complete - exception java.lang.IllegalStateException: No previous SonarQube analysis found on this pipeline execution. Please use the 'withSonarQubeEnv' wrapper to run your analysis., Ignoring.
[Pipeline] echo
12:54:38  waiting 5 seconds...
[Pipeline] sleep
12:54:38  Sleeping for 5 sec
[Pipeline] withSonarQubeEnv
12:54:43  Injecting SonarQube environment variables using the configuration: SonarQube Server
[Pipeline] {
[Pipeline] waitForQualityGate
12:54:43  Checking status of SonarQube task 'AYmJd83KXNLj3HTPhklS' on server 'SonarQube Server'
12:54:43  SonarQube task 'AYmJd83KXNLj3HTPhklS' status is 'IN_PROGRESS'

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hey Mark.

Did you also configure the project-level webhook?

It was not configured

If you configure it, does it work?

Yes, thank you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.