The Jenkins waitForQualityGate step hangs until it times out. What's wrong?
IntermediateTroubleshootingSonarQube
Answer
Short answer
Jenkins is waiting for SonarQube to call back through a webhook with the quality gate result, and the call never arrives. Usually the webhook isn't configured, has the wrong URL, can't reach Jenkins over the network, or a webhook secret doesn't match.
Checklist
- SonarQube → Administration → Configuration → Webhooks: URL is
https://<jenkins-url>/sonarqube-webhook/(trailing slash matters). - From the SonarQube host/pod:
curl -I https://jenkins.company.com/sonarqube-webhook/— network/firewall/proxy OK? - If a webhook secret is set in SonarQube, the same secret must be configured in Jenkins' SonarQube server settings.
- SonarQube → project → Project Settings → Webhooks → recent deliveries show the HTTP status and error.
- The analysis step must run inside
withSonarQubeEnvso Jenkins knows which task to wait for. - Keep a
timeout(time: 5, unit: 'MINUTES')around the wait so jobs never hang forever.
What to say in the interview
"waitForQualityGate depends on SonarQube's webhook to Jenkins. I check the webhook URL with /sonarqube-webhook/, network reachability from SonarQube, matching secrets, and the delivery log in SonarQube, and always wrap the step in a timeout."
More on SonarQube
What is SonarQube and how do you integrate it into a pipeline?BeginnerWhat does SonarQube analyse?BeginnerHow do you run SonarQube locally with Docker?BeginnerHow do you scan a project with sonar-scanner?BeginnerHow do you run SonarQube analysis for a Maven project?BeginnerWhat is a quality gate in SonarQube?Beginner