How to achive Branch analysis different for master and its branches


(Rajaneesh K) #1

I need to figure it out differently…How to do it ? I have installed the branch plugin for SonarQube 7.1 version and its not helping me… only master is visible in SonarQube

My planned organization for the Branch Plugin is as follows:

  1. The “Main” branch is my “Master” branch
  2. The long-lived branches are any “DevBranch” branches
  3. The short-lived branches are any “feature,” “hotfix,” “bugfix,” or malformed-named branches

I’m trying to figure out how to get this working (what steps I need to do and when). Assume that I’ve got a clean SonarQube server and the sonar scanner/runner.

My questions are:

  1. How do I define the main branch so that analysis are made separately for master and its corresponding branches?

  2. Do I need to change the [sonar.branch.name] for master and its branches please mention how to do?

  3. We are following the maven <groupId>:<artifactId> pattern with no additional information

  4. Our sonar.projectName is provided through sonar analysis section in post build actionbs in Jenkins.

Presently I am getting both Master and its branches in same analysis I am unable to differentiate between the master sanalysis and branch analysis in sonarqube…

sonar.projectKey=$JOB_NAME
sonar.projectName=$JOB_NAME
sonar.projectVersion=1.0 for master and 2.0 for dev
sonar.projectKey=$JOB_NAME
soanr.branch.name=“master”/for devbranch I change here /“devBranch”
sonar.sources=/var/lib/jenkins/workspace/
sonar.java.binaries=**/target/classes


(Duarte Meneses) #2

Hi,
Branch analysis has had a lot of improvements throughout the 7.x series.
Could you upgrade to SQ 7.6?

Then, all you have to do is:

  • Define, in the UI, what pattern to use to classify a branch as a short or long living.
  • First analyze master, by not providing any parameters related to branches.
  • Then, when analyzing a branch, provide the following parameters to the SonarQube Scanner: -Dsonar.branch.name=xxx and -Dsonar.branch.target=yyy.

(Rajaneesh K) #3

Hi Meneses,

Thanks for the followup…

Can you please share a screenshot of differential analysis done on master and branch on a single sonarqube project.


(Duarte Meneses) #4

Here is an example: https://next.sonarqube.com/sonarqube/dashboard?id=org.sonarsource.sonarlint.core%3Asonarlint-core-parent

This project has 2 branches. You can switch branches on the drop down menu on top, next to the project’s name.


(Rajaneesh K) #5

Hi,

Is the drop-down available for community edition of sonarqube???If yes please tell how to configure in Jenkins to achieve it…If no which edition do I need…


(Duarte Meneses) #6

Support for branches is not available in the community edition.
It’s part of the developer edition. You can find more information here: https://www.sonarsource.com/plans-and-pricing/


(Rajaneesh K) #7

Hi,

I came across a plug-in called branch plugin will that help me to achieve it in community edition.


(Rajaneesh K) #8

How can we compare different branches of a project and show it on a single dashboard in soanarqube.

Please provide a screenshot if already implemented try share the procedure…


(Duarte Meneses) #9

That plugin is not developed by SonarSource and I’m not able to help with it.
Most likely it will only support a small part of the branch feature as offered by the developer edition.


(Rajaneesh K) #10

Is there any way to showcase different branches analysis of same project on single dashboard…i.e I want to know which branch is efficient…


(Rajaneesh K) #11

Can we compare different branches of a project and show it on a single dashboard in SonarCloud for free???


(Rajaneesh K) #12

Hi,

This link is not helping me to find out the analysis done on different branches of a project on sonarqube.

I just see the MASTER and PULL REQUESTS.

Can you please share a link which can show MASTER and BRANCHES(in DROP-DOWN).


(Duarte Meneses) #13

Here are two screenshots: one of the drop down, other from the page to manage branches.
If you would like to know more about what is offered by the developer edition and get a trial license to try it out, you can contact us through the form here.


(Rajaneesh K) #14

Hi,

Thanks for the follow up…

Can I get a trail version of the developer edition like for few hours so that I can come to a conclusion and take a Decision.


(Duarte Meneses) #15

Hi,
Sure, you can request a trial here: https://www.sonarsource.com/plans-and-pricing/developer