node.jstypescriptsonarqubesonarqube-scan

`sonarqube-scanner@^4.0.0` doesn’t return non-zero exit code in case of Quality Gate failure


When we run it as

npx sonarqube-scanner@^4.0.0 -Dsonar.qualitygate.wait="true" [....]

we expect non-zero exit code if Quality Gateway finds new issues that must be fixed.

But the actual result: this command always return 0 exit code, and our build never fails.

At the same time, sonarqube-scanner@^3.5.0 works as expected and really fails the build, but ^4.0.0 doesn't.

Does anyone know how to set it up with sonarqube-scanner@^4.0.0 and Node.js 20+?

enter image description here


Solution

  • It is a bug, confirmed buy sonarqube-scanner developers.

    See https://community.sonarsource.com/t/sonarqube-scanner-4-0-0-doesnt-return-non-zero-exit-code-in-case-of-quality-gate-failure/118755/4

    And Jira issue: https://sonarsource.atlassian.net/browse/SCANNPM-39