Jenkins sonarcloud webhook errors on non gradle builds

We have some Jenkins instances running on Azure Kubernetes behind traefik and we have the sonarqube plugin installed.

For some reason, we are getting errors with the sonarqube-webhook when using sonar-scanner and sonarcloud. The errors don’t occur when using gradle.

The plugin receives the webhook call in both cases but when using sonar-scanner, an error is thrown about “Cannot find current thread”.

Taking the request content and submitting a curl request throws a 500 internal server error - though sometimes, changing the taskId causes the same request to succeed, but this is inconsistent.

I can’t figure this out, it doesn’t seem to be network related as gradle based pipelines trigger the webhook fine. It seems to be specific to any pipeline using the sonar-scanner executable.

Has anyone had something similar happen before?

Hey there.

Can you include the full logs from when this happens? It would also be helpful if you shared exactly how your Jenkinsp pipeline is configured.

Hi Colin,
sonarqube webhook error.txt (12.1 KB)

Thanks for the quick reply.

Please see attached an example error from the logs.

With regards to the pipeline setup, the pipeline is quite complex. Is there something specific you would like me to detail?

We use configuration as code to control our pipelines. Here is where the sonar-scanner executable is being called within our jenkins config when running a yarn build https://github.com/hmcts/cnp-jenkins-library/blob/10136a41686f122da2be7a9c791d744943625ac4/src/uk/gov/hmcts/contino/YarnBuilder.groovy#L47-L50

And here is the same thing for gradle https://github.com/hmcts/cnp-jenkins-library/blob/10136a41686f122da2be7a9c791d744943625ac4/src/uk/gov/hmcts/contino/GradleBuilder.groovy#L49-L53

The scans run within the pipeline and connect to sonarcloud. We have webhooks setup in sonarcloud which get sent to an azure logic app then to a service bus queue and then on to jenkins. It’s a multi step process but I’ve been triggering calls locally on the AKS cluster using curl to bypass all the extra infra and the same errors occur.

The error in the attached log was thrown after I ran a curl request but it’s identical to what happens automatically from the pipeline.

No. But if you’re reaching out on a community forum for help, providing the most details possible increases your odds in being able to get some help. :slight_smile:

What version of Jenkins are you using? There seems to be a similar issue reported some years ago here: Loading...

2.425

Thanks.

It looks like there was at least one similar report back in April: Loading...

And after that… :person_shrugging: I’m out of my depths. I’ll ping another team on this. Do you know when the issue began, roughly?

I don’t have a specific date but sometime late July/ early August

We’ve just tested bypassing the logic app and service bus and sending webhook calls directly to jenkins and this seems to be working. Not sure what’s different about the other setup as the requests are the same.

Hello @endakelly,
Sorry for the delay, we looked more into the issue but we cannot reproduce or find why this error would happen. It seems to be a low-level issue with Jenkins.
Please let us know if you can identify what is different between the direct webhook calls or when it’s going through the logic app.