Friday, 10 July 2020

Fix SonarQube does not return status of waitForQualityGate() to jenkins?

Try to put sleep(60) command before the check:
sleep(60)
timeout(time: 1, unit: 'MINUTES') {
    def qg = waitForQualityGate()
    print "Finished waiting"
    if (qg.status != 'OK') {
        error "Pipeline aborted due to quality gate failure: ${qg.status}"
    }
}  
It solved same problem for me.

from : https://stackoverflow.com/questions/56209464/sonarqube-does-not-return-status-of-waitforqualitygate-to-jenkins

Monday, 22 June 2020

How to obtain the SonarQube project URL in Jenkins pipeline?

You can use env var SONAR_HOST_URL inside the sonar block, like this:

withSonarQubeEnv('my-sonar') {
    def sonar_host_url = env.SONAR_HOST_URL
    echo '${env.SONAR_HOST_URL}'
    // my-sonar.example.com
}

Fix SonarQube does not return status of waitForQualityGate() to jenkins?

Try to put  sleep(60)  command before the check: sleep(60) timeout(time: 1, unit: 'MINUTES') { def qg = waitForQualityGate() ...