SonarQube Version 22.214.171.124_1933
Using TeamCity (TC) with dotCover and SonarQube (SC).
The SonarQube is always one build behind TC build which I thing is the reason that I can’t see New Code Coverage change.
The TC build (last build number 1933):
Last build shown on SC (last build number 1909)
What I see is a warning
Could this warning be the reason why the last build isn’t shown in SC?
But tomorrow the one from today not shown yet will be shown and so on.
Detail message from the warning:
For the encoding warning I found few files (in build log) and changed the encoding but still don’t get read of this encoding warning. Can’t find further files in log for an encoding issue.
Also add this property to TC settings /d:sonar.sourceEncoding=utf-8
For any hint I would be appreciated.
First, could you double-check this please?
You’ll find the SonarQube version number in the page footer.
Sorry, but I’m not understanding the problem. Is this about code not being analyzed when it should be? (That would be a question of your CI configuration.) Or is this about your New Code Period resetting with each analysis? If the latter, then you’ve probably chosen “Previous version” as your New Code Period setting. And by passing in build number - which changes with each build - as your
sonar.projectVersion value, you’re forcing a reset each time.
The remedy for this would be to do some string manipulation to chop off everything after the
_ before you use the value as your
First, thank you for your quick response.
Sorry my mistake copied wrong version number. This is the correct one
- Enterprise Edition
- Version 8.9.1 (build 44547)
Let me try to explain again:
If the build is started on TC the build number is 1933. After build is finished the SQ show the older build version number 1909. (since 1909)
Maybe I’m the whole time on wrong path. My goal is to show the new code coverage on SQ. But nothing what did solved my issue. The new code coverage stays on 0%.
My setup on TC start build step:
I think there are two different topics here: build number / project version, and code coverage. Since we’ve started on the first one, and since we try to keep it to one topic per thread, let’s focus here on build number & you can open a new thread for coverage once we sort this out.
So… your screenshot shows you’re passing
%build.number% as your project version. So it’s really a TeamCity question at this point, as far as I can tell. The question is why TC is passing the wrong value for that variable into analysis.
And BTW, if you’d like to double-check what values were passed, you can go to Project Settings → Background Tasks → [analysis row] → [cog menu] → Show Scanner Context. Look under the section labeled ‘Project scanner properties:’.
Thank you. We now solved. We removed the build.number from project version and using the “%dep.FullVersionDeployment_Core_5thGeneration_0RefreshGitBranches.ReleaseVersion%” instead.