Merge Request decoration from Sonarcloud is not showing at

Hi Sonarcloud team,

I am having problem with merge request decoration. I am using Sonarcloud paid plan and I tried to display the quality status in every merge request as the decoration. I tried this settings at my .gitlab-ci.yml.

But nothing is showing.

Nothing is showing as well in the Merge Request panel in the project panel.

I am not sure if there are steps that I missed. Please help.

I tried opening the background task. Somewhat the pr key, base and branch is not showing. Are they related to this problem? How do I obtain the correct parameter values?

Screen Shot 2021-10-10 at 11.36.47

Hello @petrabarus,

Yes, the missing parameters are for sure related to the problem you are facing. Can you please try to print out the CI_MERGE_REQUEST_IID parameter or harcoded it for one run to see if it is passing?

In principle specifying these parameters is not required as they should auto-detected if you use Gitlab CI. Can you give it a try and run without providing any sonar.pullrequest.* parameters? (I recommend to this on toy project as it may overwrite the analysis of the main branch)

Marcin Majewski

Hi Marcin,

Thanks a lot for the reply. I tried adding the lines below, and somewhat it works. The sonar shows the merge decoration.

  - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'

What does it do actually?


Hello @petrabarus,

In this example, it looks like the template enforces the run of the CI only if the following variables are set. These variables are necessary as you reference them from your sonar-scanner execution template, although I am not sure why in your case you have to have a template in order for the env variables to be available, they should be available in Gitlab regardless (as this template checks for their existence).


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.