We are using the following release workflow: a release branch “release/…1.2.3” is created from the develop branch and after a manual confirmation the CI builds release packages 1.2.3 and creates the Git tags accordingly. There is no “master” branch but the release branch is merged back to the develop branch afterwards.
Now the problem is that it would be beneficial using
sonar.projectVersion to be able to compare the different versions but it seems to be treated per branch so a version “created” during the build of one release branch is not “seen” from other branches. So the whole feature only works if there is a common branch from which all versions are built/created.
I understand that the commonly used pattern is to make release builds from a “master” branch but the problem is that you are testing a different build (from the release branch) than you are releasing/deploying at the end when building the master branch.
Wouldn’t it make more sense to make the “versions” project-specific instead of branch-specific so it does not matter where the version came from as IMO there will be no conflicting versions anyway for the same project.
It’s not entirely clear to me what you’re after. However, I’m guessing the ability to set one branch as the New Code Period baseline (Reference Branch) for another branch might help…?
My goal is to label the release build analyses with the respective version using the
sonar.projectVersion property so i can follow the versions in the project history to check how e.g. the number of issues developed over time from one version to the other.
Currently this is not possible as the versions are treated as branch-specific by SonarQube so i can only see the versions from analyses of the currently selected branch, e.g. master. As our release build analyses are made directly from the respective release branches i can only see the respective release version when i select the release branch, but not a trend over all versions of the project.
I hope this makes it clearer, otherwise i can add some screenshots if needed.
I’m going to re-state to make sure I understand:
You want to compare analysis n of branch A (with
sonar.projectVersion=1.1.1) with analysis m of branch B (with
Many moons ago - long before branch analysis - there was a feature that let you compare projects or versions of projects to each other to see differences in metric values. It got dropped because in the end it didn’t seem to make much sense.
So unfortunately, you’re going to have to make such comparisons manually.
Here are some screenshots, i hope this will clarify it.
This is the develop branch, as you can see there is only the “develop” version in the list as this is what is set for
sonar.projectVersion when building/analysing the develop branch. There are no other versions shown since these were created with the analysis of other branches (the release branches).
This is a release branch, as you can see there is only the respective release version shown.
I would like to see all versions in the Activity view of the main (develop in our case) branch.
That’s not going to be possible unless you analyze them all as the same branch.
That’s exactly the problem and from my POV it would make sense to move the versions to project-level so there is no need to do the analyses in one branch.