I am having problem with merge request decoration. I am using Sonarcloud paid plan and Gitlab.com. I tried to display the quality status in every merge request as the decoration. I tried this settings at my .gitlab-ci.yml.
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?
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)
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).