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() ...