Welcome
yes, there’s a solution for both ways
If still using classic Jenkins jobs (it’s 2020, so i hope not ) go with the
sonar-build-breaker plugin or implement your own polling for the quality gate status
via Sonarqube web api.
If using Jenkins pipelines use the waitForQualityGate()
step / method.
Documentation https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/
There’s one gotcha, officially it’s not recommended / supported to use it within parallel step.
We’ve tried nevertheless to speed up our npm builds and it works most of the time with
intermittent errors, i.e. one of 12 analyses runs on timeout.
Every analysis creates it’s listener and waits for the json payload from Sonarqube webhook
and i guess there are threading problems.
The problem is known by Sonarsource and they are already on it, see
https://jira.sonarsource.com/browse/SONARJNKNS-316 with other tickets linked.
Gilbert