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.
More on Integrations: SonarQube, Nexus, Artifactory, Docker, Trivy
How do you integrate SonarQube with a Jenkins pipeline?IntermediateHow do you deploy Maven artifacts to Nexus from Jenkins?IntermediateHow do you publish npm packages or pull dependencies through Nexus or Artifactory?BeginnerHow do you use JFrog Artifactory from Jenkins?IntermediateHow do you build and push a Docker image from Jenkins on a VM agent?BeginnerHow do you scan an image with Trivy in a pipeline and gate on results?Intermediate