Sonar-Scanner return codes

Must-share information (formatted with Markdown):

  • which versions are you using: sonar-scanner 5.0.1
  • what are you trying to achieve:
    I want to be able to make decisions based on the return code of a sonar-scanner execution, and I was not able to find any documentation on what exactly a return code meant. could you please provide a link or atlease an overview of what exactly each return code of sonar-scanner means. Thank you.

Hey there.

0 = success
non-zero = failure. Either the scanner itself failed, or you specified sonar.qualitygate.wait and polled for the Quality Gate status which ultimately was failing.

Hi Colin, thanks for your response. So this means that there is no way to distinguish between the scanner failure and quality gate failure. Because i am getting a rc=2 for a quality gate failure, i was looking for a way to distinguish them,

You’re correct – there’s no way to distinguish based on the exit code.