title: integrating gitlab with sonarqube
body: <p>I have GitLab CE (v8.5 at least) installed on my server. I would like to integrate it with sonarqube so that merge requests shows any issues in the comment section. Has anyone integrated these 2 systems successfully?</p>
  
  <p>At the moment, only sonarqube plugin I found is the following but I'm not able to successfully integrate it with GitLab.</p>
  
  <p><a href="https://gitlab.talanlabs.com/gabriel-allaigre/sonar-gitlab-plugin">https://gitlab.talanlabs.com/gabriel-allaigre/sonar-gitlab-plugin</a></p>
  
  <p>I used a docker container for sonarqube (v5.5) and copied the plugin into extensions directory. Configured gitlab user token and gitlab uri in the plugin's setting page in sonarqube.</p>
  
  <p>I'm using GitLab CI for continuous integration and I have the following build job for sonarqube (using gradle)</p>
  
  <pre><code>sh gradlew sonarqube -Psonar.analysis.mode=preview -Psonar.issuesReport.console.enable=true \
    -Psonar.gitlab.commit_sha=$CI_BUILD_REF -Psonar.gitlab.ref_name=$CI_BUILD_REF_NAME \
    -Psonar.gitlab.project_id=$CI_PROJECT_ID
  </code></pre>
  
  <p>But, I'm not sure what to after this. Couple of questions:</p>
  
  <ol>
  <li><p>What happens when a merge request does not exist yet? In my git workflow, users will submit a merge request after they're done working on their branch. So, how will this plugin know which merge request to update?</p></li>
  <li><p>Right now I have the sonarqube valiation task set to be running only on master branch. I think this will need to be changed to user branches too, right?</p></li>
  </ol>
  
  <p>I did try submitting a merge request, but I didn't see any comments being added. I think I'm missing some configuration or a process. Really appreciate if you can help point me to the right direction.</p>