Sonar-scanner analysis and projectVersion(s)

1,452 views
Skip to first unread message

Gennady Feldman

unread,
Jul 19, 2017, 11:18:12 AM7/19/17
to SonarQube
Hi,

I've been trying to understand how the Version is tracked in a project.

There are two scenarios that I am working on:
- Changes on the current master (unreleased) code.
- Changes since the previous release (possibly pulling data and archiving this historically outside of sonarqube) so I could track things from release to release.

One thing that is confusing to me and I know I am missing something.
1. If I set a version then it records it in the Project -> Activity timeline.
2. If I don't set a version then it uses the last version that was reported. (Moves the last version string to the last analysis).

If I set project to use the default leak period of "previous_version" how would that work with Github flow? Are there any examples/docs for this?
Do I need to know the "next" version as soon as something is released? What about the code in between releases?

Thank you,

Gennady

G. Ann Campbell

unread,
Jul 20, 2017, 8:25:21 AM7/20/17
to SonarQube
Hi Gennady,

I don't understand the difference between your two scenarios.

I also don't understand what you're asking about GitHub Flow. A quick search tells me it's about branching. Currently, each branch is treated as an independent project, so what happens in one branch will have no impact on another branch.


Ann

Gennady Feldman

unread,
Jul 20, 2017, 11:03:02 PM7/20/17
to SonarQube
Hi Ann,

Let me try and clarify things with an example.

Let's say I have a Java project i've been working on and I want to start using SonarQube. I haven't released any releases yet.

I am going to be focusing on 2 SonarQube screens: dashboard (home icon) and project activity. I am using the default Leak Period of previous_version.

I update my Mavan pom.xml and set version 1.0.

I run "sonar-scanner -Dsonar.projectVersion=1.0".

My activity in SQ looks like:
- Version: 1.0

Now i change pom.xml to 1.1-SNAPSHOT and commit that into GitHub.
Then I run "sonar-scanner -Dsonar.projectVersion=1.1-SNAPSHOT".
My activity in SQ looks like:
- Version: 1.1-SNAPSHOT
- Version: 1.0

The dashboard screen in the leak column is reporting things properly and comparing against 1.0 version.

Let's say I merge 3 PRs that fix code coverage and maybe add some new features.
If I run "'sonar-scanner" (notice I don't need to give it version)

I see activity page as:
- Version: 1.1-SNAPSHOT
-
-
-
- Version: 1.0

If i decide to cut a release things get weird. If i cut 1.1 and give that to sonar-scanner then
this creates 3rd version in activity and Leak column now shows diff against the 1.1-SNAPSHOT version.
Ideally i want to see the leak against 1.0 since technically I only did 2 releases and that's what I am trying to measure.
The stuff in the middle is something of a SonarQube requirement. Also if I don't touch the version or don't
specify one during sonar-scanner analysis run then SQ server just moves the last Version to the last analysis.

My understanding is that any code changes between releases are somewhat temporary/intermediate. They might never
be released or things can change until an actual release happens.

Thank you,

Gennady

G. Ann Campbell

unread,
Jul 21, 2017, 8:15:40 AM7/21/17
to Gennady Feldman, SonarQube
Hi Gennady,

Yes, that bit is a little awkward. What we do is manually clean up the history, either by editing the version string to drop "-SNAPSHOT" or even deleting an analysis if necessary.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/IH7Tidjr38o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/3466a018-e917-41a8-9553-8fe369045097%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gennady Feldman

unread,
Jul 21, 2017, 9:40:53 AM7/21/17
to SonarQube
Hi Ann,

Thanks for a quick reply. Is it possible to fix this on the server side? Something like adding an optional flag for "temporary"/unreleased versions which would get cleaned up automatically when a real version/release comes in?

Is it possible to open up a Jira ticket for this?

Thank you,

Gennady

On Wednesday, July 19, 2017 at 11:18:12 AM UTC-4, Gennady Feldman wrote:

G. Ann Campbell

unread,
Jul 21, 2017, 9:46:49 AM7/21/17
to Gennady Feldman, SonarQube
Hi Gennady,

We don't currently have any plans to change this behavior.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/IH7Tidjr38o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages