mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-26 08:06:09 +01:00
Jenkins: Also waits for SonarQube quality goal status for PRs.
This commit is contained in:
15
Jenkinsfile
vendored
15
Jenkinsfile
vendored
@@ -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}"'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user