sonarqube-community-branch-plugin icon indicating copy to clipboard operation
sonarqube-community-branch-plugin copied to clipboard

[SQ8] Gateway summary but no individual code smell decoration on gitlab

Open bcouetil opened this issue 2 years ago • 7 comments

Thank you for the wonderful work, that helped me for years 🥰

Describe the bug With Gitlab, the MR is decorated with quality gate status, but no individual code smell decoration. It used to work with SonarQube 8.4 and associated plugin version.

To Reproduce Classic usage with Gitlab

Expected behavior A way to know what's wrong, if this is a user misconfiguration

Screenshots

Sonarqube CE logs :

2022.07.19 09:35:05 INFO  ce[AYIVz5HYJEFr3rsCCqQN][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] using pull request decorator com.github.mc1arke.sonarqube.plugin.ce.pullrequest.gitlab.GitlabMergeRequestDecorator
2022.07.19 09:35:08 INFO  ce[AYIVz5HYJEFr3rsCCqQN][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request Decoration | status=SUCCESS | time=3316ms
2022.07.19 09:35:08 INFO  ce[AYIVz5HYJEFr3rsCCqQN][o.s.c.t.CeWorkerImpl] Executed task | project=minz | type=REPORT | pullRequest=1936 | id=AYIVz5HYJEFr3rsCCqQN | submitter=me | status=SUCCESS | time=5653ms

I did not find anything meaningful using DEBUG logs, so I won't paste them for now

Software Versions

  • SonarQube Version: 8.9.9
  • Plugin Version: 1.8.2
  • Gitlab : gitlab.com (GitLab Enterprise Edition 15.2.0-pre [23631a9ae51])

bcouetil avatar Jul 19 '22 11:07 bcouetil

I forgot to mention that this is a mono-repository, so one project on Gitlab side and multiple projects on SonarQube side. I tested by adding deliberate code smalls to 2 modules.

bcouetil avatar Jul 19 '22 11:07 bcouetil

Although, I may use some outdated scanner fields :

sonar.pullrequest.key=$CI_MERGE_REQUEST_IID 
sonar.pullrequest.branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME 
sonar.pullrequest.base=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME 
sonar.pullrequest.gitlab.instanceUrl=$CI_API_V4_URL
sonar.pullrequest.gitlab.projectId=$CI_PROJECT_PATH 
sonar.pullrequest.gitlab.projectUrl=$CI_MERGE_REQUEST_PROJECT_URL 
com.github.mc1arke.sonarqube.plugin.branch.pullrequest.gitlab.pipelineId=$CI_PIPELINE_ID 
sonar.scm.revision=$CI_COMMIT_SHA

bcouetil avatar Jul 19 '22 11:07 bcouetil

The fact you're getting the Quality Gate status indicates the ability to post a summary comment is ok. I'd expect a failure to post a 'diff' comment would cause an error in your logs, so would need to see either your debug-level logs, or an example Merge Request that I can try and replicate the issue is with myself

mc1arke avatar Jul 19 '22 20:07 mc1arke

Thank you for your time.

An example MR to show would be too complicated as of now, so here are debug logs : sonarqube_ce(13).log

bcouetil avatar Jul 21 '22 08:07 bcouetil

Does it help ?

bcouetil avatar Jul 27 '22 11:07 bcouetil

Hey @bcouetil, we recently updated from GitLab 14.4.x to 15.3.x and SonarQube from 9.5 to 9.6.x and facing the same issue you described. Do you still have the issue or any solution?

xC0dex avatar Sep 12 '22 11:09 xC0dex

Unfortunately no solution as of now...

I guess @mc1arke has not found time to dig into this for now...

bcouetil avatar Sep 13 '22 06:09 bcouetil

Anyone coming to this issue knows a working version ?

bcouetil avatar Dec 01 '22 10:12 bcouetil

I have exactly same issue with Sonar 8.9 and BB 7.18. No signs of error on sonar plus I can see branch and PR analysis on Sonar but no decoration on BB PR page.

yaverhussain avatar Dec 07 '22 12:12 yaverhussain

Someone gave me a recent working couple in issue #678

bcouetil avatar Dec 07 '22 16:12 bcouetil

The latest this bundle has is sonar 9.5.0 unless you have your own docket image pulling 9.6.1 sonar with latest pull request community plugin

yaverhussain avatar Dec 07 '22 21:12 yaverhussain

Ok update is I got it working Sonar 9.6.1, Community plug-in 1.12.0. Couple of gotchas but ended up well. Have raised a PR as well to make it easier for next guy

yaverhussain avatar Dec 08 '22 09:12 yaverhussain

We had similar issue in our project, only summary without individual comments. The problem was in the setup, Administration -> ALM Integrations -> GitLab URL (sonar.auth.gitlab.url) needs to be https://gitlab.com/, not https://gitlab.com/api/v4/.

mareksabo avatar Jan 20 '23 20:01 mareksabo