diff --git a/Jenkinsfile b/Jenkinsfile index c8cad51..a9b23d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -155,9 +155,11 @@ pipeline { steps { // Wait for the Quality Gate result and fail fast on non-green outcomes. timeout(time: 15, unit: 'MINUTES') { - def qualityGate = waitForQualityGate() - if (qualityGate.status != 'OK') { - error "SonarQube Quality Gate failed: ${qualityGate.status}" + script { + def qualityGate = waitForQualityGate() + if (qualityGate.status != 'OK') { + error "SonarQube Quality Gate failed: ${qualityGate.status}" + } } } }