# SonarQube Pull Request Decoration with GitLab CI - can't get it to work

**URL:** <https://community.sonarsource.com/t/sonarqube-pull-request-decoration-with-gitlab-ci-cant-get-it-to-work/27447>\
**Category:** SonarQube Server / Community Build\
**Created:** [July 2, 2020, 12:15pm UTC](https://community.sonarsource.com/t/sonarqube-pull-request-decoration-with-gitlab-ci-cant-get-it-to-work/27447 "2020-07-02T12:15:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Daniel\_Meppiel](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/daniel_meppiel/32/13047_2.png) [@Daniel\_Meppiel](https://community.sonarsource.com/u/Daniel_Meppiel)\
**Post date:** [July 2, 2020, 1:40pm UTC](https://community.sonarsource.com/t/sonarqube-pull-request-decoration-with-gitlab-ci-cant-get-it-to-work/27447/2 "2020-07-02T13:40:40Z")

</div>

Hi Danilo,

If your goal is to analyse a Pull Request, then please have a look at this [documentation page](https://docs.sonarqube.org/8.1/analysis/pull-request/). You’ll see there that you need to pass the following three parameters to the scanner:

- sonar.pullrequest.base
- sonar.pullrequest.key
- sonar.pullrequest.branch

From your configuration I see you are however passing sonar.branch.name parameter instead. This will consider your analysis to be a Branch Analysis and not a Pull Request Analysis. Also, you must use “only: merge\_requests” in your pipeline or a “rules” equivalent syntax (read [this page](https://docs.gitlab.com/ee/ci/merge_request_pipelines/) from GitLab) so that GitLab triggers a build correctly configured for any pull request (aka merge request). This is what you did on step 7 but you should differentiate the pipeline to scan branches (pass sonar.branch.name parameter) from the pipeline to build merge requests (pass the 3 parameters I pointed out above).

Also, I recommend you upgrade to version 8.3: you will get these 3 parameters auto populated, bug fixes etcetera. My config with version 8.3 looks like this:

```
image:
  name: sonarsource/sonar-scanner-cli:latest
  entrypoint: [""]
variables:
  GIT_DEPTH: 0
sonarqube-check:
  stage: test
  script:
    - sonar-scanner -Dsonar.qualitygate.wait=true
  allow_failure: true
  only:
    - merge_requests

```

Hope it helps, cheers,  
Daniel

---

_[View the full topic](https://community.sonarsource.com/t/sonarqube-pull-request-decoration-with-gitlab-ci-cant-get-it-to-work/27447)._
