Scan using branch plugin and webhook fails to get quality gate and doesn't report back to stash

We use SonarQube and BitBucket extensively in our org. In a previous position in the same org, I’d constructed a well-working build process, where pull requests created in BitBucket would automatically spawn a build including a SonarQube scan of the branch, and it would report back the results and integrate coverage and issues into the pull request view. We didn’t use quality gates then.

I’m now on a new team, where quite a few things are different. When the build process was set up, they didn’t implement builds of pull requests. That’s part of what I’m trying to accomplish now. On the SonarQube side, they implemented the branch plugin and quality gates. They initially used the BuildBreaker plugin.

I’m attempting to convert to the webhook strategy. I followed instructions described at .

The block of code in my Jenkins pipeline script now looks something like this:

	withSonarQubeEnv("SonarQube") {
	sh 'mvn ' \
		+ '' + props[''] \
		+ ' -s $MAVEN_SETTINGS sonar:sonar'

timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout
	def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv
	if (qg.status != 'OK') {
		error "Pipeline aborted due to quality gate failure: ${qg.status}"

My console output looks something like this:

	[INFO] org.sonar.plugins.stash.StashIssueReportingPostJob@63fc39c7 not enabled, skipping
[INFO] Task total time: 1:16.734 s
[INFO] ------------------------------------------------------------------------
Checking status of SonarQube task 'AWQAkwgAuZdogdUABtHN' on server 'SonarQube'
SonarQube task 'AWQAkwgAuZdogdUABtHN' status is 'PENDING'

After the last line here is displayed, the job hangs essentially forever. The last time I tried it, I killed the job after waiting 30 minutes.

I also note that the BitBucket pull request still has the old scan information (I can tell because the previous one that completed failed the quality gate, because it was using the BuildBreaker plugin, which causes weird bugs). I don’t know whether that message about the “StashIssueReportingPostJob” not being enabled is the cause of this.

So what might I be doing wrong?

Hey David, I’ve linked to your issue in my bug report.

Ok. Note that I think there are two issues here, and one of them might not be critical. I’m not sure why the StashIssueReportingPostJob thing is happening, but the bigger problem is the infinite wait for the quality gate.

I observe the same issue.


I observe the same issue when background tasks are in queue, webhook is not sending status.