What does the jenkins webhook actually do?

A few days ago our SonarQube administrators removed the BuildBreaker plugin, so I had to get the “recommended approach” using webhooks to work. I had previously tried it and it didn’t work. The pipeline step to wait for the quality gate never returned.

It wasn’t working on Friday, but for some reason over the weekend it simply started working. I don’t know whether some admin changed something or not. I’ll find out more on Tuesday.

However, one thing did occur to me. I had started testing this by setting the webhook url in one project and testing builds for that project.

I have another project that is a copy of that first project, but without a webhook url. What I noticed is that both builds are now getting past the “wait for quality” gate step, even the one that doesn’t have a webhook url.

This leads me to wonder, what is the point of setting the webhook url anyway? I can see the documentation saying what information it sends to Jenkins, but what makes use of this information? The only place I’m aware of that Jenkins looks at SonarQube is in this “wait for quality gate” step, and that appears to be working fine (for some reason) without any webhook url.

Hello David,

No idea on why this started to suddenly work.

What I noticed is that both builds are now getting past the “wait for quality” gate step, even the one that doesn’t have a webhook url.

How are the both projects getting past the step in more detail? Do they simply time-out ?

The only place I’m aware of that Jenkins looks at SonarQube is in this “wait for quality gate” step, and that appears to be working fine (for some reason) without any webhook url.

It seems like maybe your configuration is incorrect - I am not saying a chance for Webhook to be passed back to Jenkins without setting the valid URL on SQ side.

Best regards,
Kris

1 Like

They’re getting past the step by apparently working. This is from the build that doesn’t have a webhook set.

12:45:28 12:45:28 [Sonar Code Coverage and Quality Analysis - QG3] Checking status of SonarQube task 'AWWgUv4C5TgLsS6D-fc2' on server 'SonarQube'
12:45:29 12:45:29 [Sonar Code Coverage and Quality Analysis - QG3] SonarQube task 'AWWgUv4C5TgLsS6D-fc2' status is 'SUCCESS'
12:45:29 12:45:29 [Sonar Code Coverage and Quality Analysis - QG3] SonarQube task 'AWWgUv4C5TgLsS6D-fc2' completed. Quality gate is 'OK'

Hello @David_Karr,

Can you share the code of the pipeline for review?

The only place I’m aware of that Jenkins looks at SonarQube is in this “wait for quality gate” step, and that appears to be working fine (for some reason) without any webhook url.

The reason for that is that it is possible to setup kind of global webhooks - so not at per project level but at SonarQube level, snipper fro the docs:

An additional set of 10 webhooks can be configured at the global level in Administration > Configuration > Webhooks .

Regards,
Kris

Hey @David_Karr ,

To connect the dots here, and avoid parallel threads, I feel like your observation below:

Could be explained by our findings from this other thread:

Agreed that this clarifies this thread too ?

Yup, this is all relatively clear now. I’ve now got a working webhook, with no intermediate sleep, and it appears to be working.

However, I’m still not 100% certain I understand the logic that happens in the “waitForQualityGate” step, although it may not matter. I believe I read that it first checks ONCE for the task, and if it’s not done, it goes into a wait loop for the webhook results. That is mostly consistent with my observations, but we did see some cases where a project that did not have a webhook set was printing TWO status lines from the step before it got to “SUCCESS”, as if it had looked first, and the task was not done, and then it checked again, and it was done.

1 Like