merge branch 2.0.0-m3, to get unstable build job on failed quality gate

This commit is contained in:
Sebastian Sdorra
2018-07-16 13:40:59 +02:00

16
Jenkinsfile vendored
View File

@@ -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,18 @@ void analyzeWith(Maven mvn) {
}
}
boolean waitForQualityGateWebhookToBeCalled() {
boolean isQualityGateSucceeded = true
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') {
isQualityGateSucceeded = false
}
}
return isQualityGateSucceeded
}
String getCommitAuthorComplete() {
new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{author}"'
}