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.
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.
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 .
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.