Interview Prep/Jenkins/Integrations: SonarQube, Nexus, Artifactory, Docker, Trivy

How does `waitForQualityGate` work?

IntermediateConceptIntegrations: SonarQube, Nexus, Artifactory, Docker, Trivy
Answer

After analysis, the scanner writes report-task.txt with the task ID. waitForQualityGate reads it and pauses (without holding an executor if called outside an agent) until SonarQube calls back Jenkins' webhook https://jenkins/sonarqube-webhook/ with the quality gate result.

stage('Quality gate') {
  steps { timeout(time: 10, unit: 'MINUTES') { waitForQualityGate abortPipeline: true } }
}

Without the webhook configured in SonarQube (Administration > Configuration > Webhooks), the step waits until timeout. It must run in the same build after withSonarQubeEnv.

All Jenkins questions Roadmap: Jenkins

More on Integrations: SonarQube, Nexus, Artifactory, Docker, Trivy