sonar-gitlab-plugin icon indicating copy to clipboard operation
sonar-gitlab-plugin copied to clipboard

Inline comment only generated in Master branch

Open jeoy opened this issue 6 years ago • 11 comments

I am using [email protected] and [email protected],

My gitlab-ci.yml is:

sonar-scanner \
  -Dsonar.projectKey=$SONAR_KEY \
  -Dsonar.sources=. \
  -Dsonar.host.url=$SONAR_URL \
  -Dsonar.login=$SONAR_LOGIN
  -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA \
  -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME \
  -Dsonar.gitlab.project_id=$CI_PROJECT_ID

Commit in non-master branch

If this commit not on the Master branch, when quality gate is failed, SonarQube always generates global comment like below: commit in non-master branch

But always says "reported no issues" and `no inline comment`,

Commit in Master branch

However, commit in Master branch (with same changes), it generates global comment with issues and inline comments :

commit in Master branch


I expect it generates global comment with issues and inline comment on all branch.

Any help would be appreciated!

jeoy avatar Jan 21 '19 06:01 jeoy

I observe same issue, [email protected] and [email protected],

rafalur avatar Jan 22 '19 15:01 rafalur

I recently ran into this issue and found that it was because of a mismatch between the branch name being given to Sonarqube and the ref_name argument.

Try using these two arguments -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.branch.name=$CI_COMMIT_REF_NAME.

gsumpster avatar Jan 22 '19 19:01 gsumpster

I recently ran into this issue and found that it was because of a mismatch between the branch name being given to Sonarqube and the ref_name argument.

Try using these two arguments -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.branch.name=$CI_COMMIT_REF_NAME.

Hi , george, I can't use the arguments Dsonar.branch.name you mentioned, I am using Community Edition. Does sonar branch relate gitlab branch ?

jeoy avatar Jan 23 '19 02:01 jeoy

I recently ran into this issue and found that it was because of a mismatch between the branch name being given to Sonarqube and the ref_name argument. Try using these two arguments -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.branch.name=$CI_COMMIT_REF_NAME.

Hi , george, I can't use the arguments Dsonar.branch.name you mentioned, I am using Community Edition. Does sonar branch relate gitlab branch ?

It looks that it's limitation of community edition. Analysis is run only on master branch. Too bad....

rafalur avatar Jan 23 '19 08:01 rafalur

Yup, unfortunately you won't be able to analyze multiple branches on the community edition and I believe the Gitlab Issues come from the branches issues even if the quality gate works... I don't think anything can be done about this w/o upgrading.

gsumpster avatar Jan 27 '19 21:01 gsumpster

@jeoy . Why don't you try open source branch plugin: https://github.com/msanez/sonar-branch-community I installed it, and it work for me with other branch than master

tangngocphu avatar Mar 01 '19 03:03 tangngocphu

@jeoy . Why don't you try open source branch plugin: https://github.com/msanez/sonar-branch-community I installed it, and it work for me with other branch than master

This plugin is deprecated !

hd-deman avatar May 15 '19 00:05 hd-deman

@jeoy . Why don't you try open source branch plugin: https://github.com/msanez/sonar-branch-community I installed it, and it work for me with other branch than master

This plugin is deprecated !

In the docs it links to the current version of the plugin. It seems to be maintained and supposedly works with version 7.4+. I can't test it out myself, but would this work?

dominikmontada avatar May 15 '19 00:05 dominikmontada

I has installed the sonar-branch-community plugin. But I still has the same issue as you. Have you solved the problem? If you can give me some advice , I will be grateful.

xiaomaodan110 avatar Jan 11 '21 08:01 xiaomaodan110

@jeoy . Why don't you try open source branch plugin: https://github.com/msanez/sonar-branch-community I installed it, and it work for me with other branch than master

Hi, Do your Gitlab VERSION is Commuity Edition? I have installed the same plugin, But it doesn't work .Could you please help me?

xiaomaodan110 avatar Jan 11 '21 08:01 xiaomaodan110

Oh! I got some tips. If I do not analyze my primary branch(master) by sonarqube. It will occur no issue. But if I do it , other branchs will return master branch's report,like this. and it still has no inline comment.

So I think it should be the community edition branch function leads to it.

image

xiaomaodan110 avatar Jan 11 '21 11:01 xiaomaodan110