This step pauses Pipeline execution and wait for previously submitted SonarQube analysis to complete and returns quality gate status.
Note: This step doesn't require an executor.
Requirements:
<your Jenkins instance>/sonarqube-webhook/
. The trailing slash is mandatory!withSonarQubeEnv
step to run your analysis prior to use this step
Example:
stage("build & SonarQube analysis") {
node {
withSonarQubeEnv('My SonarQube Server') {
sh 'mvn clean package sonar:sonar'
}
}
}
stage("Quality Gate"){
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}