gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 208 forks source link

How do I display direct link to project and branch in sonarqube in global comment. #117

Open gregluk opened 6 years ago

gregluk commented 6 years ago

Note: I am using the branch plugin so I can see the issues in sonarqube.

In the global comment template can I add a link direct to the project and branch in SonarQube?

The url will be something like this:

[View in SonarQube]https://testserver/sonarqube/project/issues?branch=${branchname}&id=${projectkey}

example: [View in SonarQube]https://testserver/sonarqube/project/issues?branch=feature1&id=com.test:myproject

For ${branchname} I can use the variable ${refName} as shown in your documentation. But how can I get the sonarqube project key for the id (com.test:myproject) . Is there a variable I can use to get this? Ideally I don't want it direct to a specific issue, I just want the project key. Similar to {Issue.componentKey} but I want one like ${componentKey} ?

Thanks

Veranicus commented 6 years ago

I wanted to ask, do you use gitlab ee edition in order to put anything from sonarqube to gitlab ?

gregluk commented 6 years ago

I used gitlab ce which is working fine, I just need a way of constructing the url above in the template

Veranicus commented 6 years ago

And if you are using gitlab ci you need to use runner right ? You don't have gitlab enterprise edition ?

gabrie-allaigre commented 6 years ago

Hi, Use ${baseUrl}/issues?open=${issue.key}

gabrie-allaigre commented 6 years ago

Use Gitlab ce and sonarqube ce

Veranicus commented 6 years ago

And then I will have to add gitlab runner ?

gabrie-allaigre commented 6 years ago

No gitlab runner is not mandatory, jenkins work.

gabrie-allaigre commented 6 years ago

Sorry good url is ${baseUrl}/issues?id=${issue.componentKey}&open=${issue.key}&branch=${refName}

gregluk commented 6 years ago

I don't want to link directly to an issue though, I want to go to the main page showing all the issues in that scan on sonarqube. Is this not possible? I can only link directly to a specific issue in sonarqube?

Sharp-Star commented 4 years ago

+1