Sonar qulaity gate passed only after version bumped

Hi Team,

we have observed that sonar quality gate is passing only after version bumped. Can you please let us know is there any upgrade from your end or do we need to change any settings for this?Please fell free to ask me for any information on this.

Thanks,
Revanth

Hi Revanth,

Off-hand it sounds like you’ve set your New Code definition to Previous version.

Per the docs:

Defines new code as any code that has changed since the most recent version increment of the project.

So by changing the version string, you’re wiping the slate clean.

 
HTH,
Ann

Hi @ganncamp ,

Is there a way to avoid this?we need it on daily basis. As we refreshed our CI daily. What i meant to say, we need to refresh new code on daily basis .Can we set it whenever we push new code to ci. Attached screenshot for your reference which has out new code definition setting.

Thanks,
Revanth

Hi Revanth,

I don’t clearly understand what you’re doing, so let me just offer some further explanations.

The Previous version setting kicks in when the value of the sonar.projectVersion analysis parameter changes. Some people pass in a version string that includes the build number, which means that the “version” changes with each analysis. We think that’s a bad idea for a couple of reasons. First, it means that problems in the previous commit “age out” of being “new” immediately. Second, it adds a “version change” event to every analysis, exempting them from housekeeping.

The idea with a Previous version definition for new code is that you would reset what’s considered new with each release to production. So, the sonar.projectVersion value would change, not with every build, but with every production release.

Does this help?

 
Ann