diff --git a/Jenkinsfile b/Jenkinsfile index f139f54906..fe68eb4af0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,11 +36,9 @@ node() { // No specific label stage('SonarQube') { - def sonarQube = new SonarQube(this, 'sonarcloud.io') - analyzeWith(mvn) - if (!sonarQube.waitForQualityGateWebhookToBeCalled()) { + if (!waitForQualityGateWebhookToBeCalled()) { currentBuild.result = 'UNSTABLE' } } @@ -97,6 +95,17 @@ void analyzeWith(Maven mvn) { } } +boolean waitForQualityGateWebhookToBeCalled() { + + timeout(time: 2, unit: 'MINUTES') { // Needed when there is no webhook for example + def qGate = waitForQualityGate() + echo "SonarQube Quality Gate status: ${qGate.status}" + if (qGate.status != 'OK') { + return false + } + } +} + String getCommitAuthorComplete() { new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{author}"' }