New Code with Previous version ignore failed builds

For all our projects we use Previous version for New Code and we have issues with passing build after failed build.
Description: we run sonar and didn’t pass quality gate for example with long function body, and if somebody commits code without any changes in problem file/class, the build will pass without any errors.
Therefore sonar should not ignore failed builds


What value are you passing in for sonar.projectVersion? Is it your build number? (Or does it include your build number?) If so, you’re resetting version with every build, so it’s natural that the New Code Period is reset with each build and what previously failed the Quality Gate passes with a new build.

Does that make sense?


I found that under the hood plugin set our custom version with git commit to sonar.projectVersion.
Therefore it will be correct to set sonar.projectVersion to the last success build. And what about PR’s, do they require any special options ?


For PRs this shouldn’t be an issue.

Would you mind sharing what plugin was doing this? If it’s something we did, I want to get it fixed.


We use open sourced SonarQube plugin:

1 Like