Sonarqube GitLab integration issue

Greetings! I’m having some troubles using the PR decoration with Gitlab. I’m using Sonarqube Server 8.4.2. The PR decoration works perfect, but the total code coverage is displayed wrong since there is an external job triggered that is adding 0.0% coverage, and affecting the total coverage.

Is there any way to avoid the triggering of this external job with the SQ link on the detached pipeline?

Thanks in advance for any information you can give me. Please let me know if I have to add more information about this.


Welcome to the community!

Off-hand I’m guessing this is outside the scope of SonarQube analysis, but could you give some details about this job?


Hi Ann!. Perhaps some screenshots can help:

As it seen on the images, when I run the job “sonarqube_scan_mr” on a detached pipeline (with the condition for only on merge requests on GitLab), after it finish, a second step appears automatically on “external” stage, called “Sonarqube” and it points to the sonarqube URL for the MR scan. Since automatic step is giving 0,0% coverage, so the total coverage media is being affected: (95 + 0)/2 = 47,5

Is there any way to avoid this second step to be triggered? I’m using the GitLab integration that comes with the Sonarqube 8.4.2.


I’m not familiar with the GL interface, so I’m not certain I understand what I’m seeing in your screenshot. I guess this is 2 separate analyses, one of which reports correct coverage numbers back to GL and the other of which does not? And then for some reason GL averages the values.

If that’s correct, there are a couple things here, neither of which directly relates to SonarQube IMO:

  • where is that 2nd analysis coming from and how can you turn it off? (a GL question)
  • why isn’t that 2nd job configured to report coverage? (Okay, this is an analysis configuration job, so kinda related to SonarQube but it goes away if you fix the first one).

Just for clarity part of my confusion stemmed from the fact that you cannot “update” an analysis, only replace it. So in SonarQube there is no average of coverage across 2 jobs. First you have 95% and then that’s replaced by 0% from the next analysis.


Hi Ann.

The 2nd step on the pipeline is appearing automatically. I’m not defining it in any part of my pipeline configuration. As I understand, that step is created by the Sonarqube-Gitlab integration itself, so I can’t control it in any way.


Uhm… Okay, I’m out of my depth now & have called for help.


Hi Ann,

Ok, thank you for helping me with this. If there is any need for contacting anyone by call or email, I’m available for that. Also, please let me know if there is any more information needed from my side for this.