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

  1. SonarQube → Administration → Configuration → Webhooks: URL is https://<jenkins-url>/sonarqube-webhook/ (trailing slash matters).
  2. From the SonarQube host/pod: curl -I https://jenkins.company.com/sonarqube-webhook/ — network/firewall/proxy OK?
  3. If a webhook secret is set in SonarQube, the same secret must be configured in Jenkins' SonarQube server settings.
  4. SonarQube → project → Project Settings → Webhooks → recent deliveries show the HTTP status and error.
  5. The analysis step must run inside withSonarQubeEnv so Jenkins knows which task to wait for.
  6. 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."

All Security Tools questions Roadmap: SonarQube — code quality & SAST

More on SonarQube