Is the withSonarQubeEnv command supposed to generate a sonar icon on a jenkins build even if sonar analysis fails?
I’m not sure if this expected behavior or not but I’m getting complaints from my users about this misleading them on the success of the sonar analysis,
When sonar analysis fails the sonar icon is displayed. (Screenshot attached). I would have expected the icon not to appear if analysis didn’t execute successfully.
using jenkins scripted pipeline syntax I have something like this:
For comparison, I don’t believe I get the artifactory icon (next to the sonar icon in the screenshot) if the build fails to complete artifact upload. To be fair I haven’t tested forcing a failure there but that’s how I thought it worked.
I’m not sure I understand. Are you saying that the analysis fails (meaning, the scanner gives you an error, and cannot push the analysis to SonarQube), or do you mean that the analysis completes, the result is pushed to SonarQube, but SonarQube is failing? And if the latter, what is the failure: can’t SonarQube process the analysis report (i.e.: you have an error in your Background Tasks)? Or is the Quality Gate red?
It’s the former case. The scanner gives you an error and fails on the client side…any case where the return code would be 1. In my example above I passed an invalid parameter called “foo”, but the same thing would happen if my server url wasn’t valid.
I was checking internally with my colleagues, because I cannot reproduce the error. Meaning, I don’t get the badge in case it fails. Are you using a scripted or a declarative pipeline?
What version of Jenkins are you using? Because I’m on the same Sonar plugin, and also using scripted pipelines. And the version of SonarQube should not make a difference in this case.