Gitlab merge request decorator

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube 8.5 developer edition
  • what are you trying to achieve
    Merge request decorator
  • what have you tried so far to achieve this
    Set the gitlab api url
    Set read_api access token
    Configure the projects to use the decorator

I have everything up and running, my gitlab pipelines are correctly scanning and communicating with my sonarqube server but I have 2 issues with the MR decorators

  1. The doc mentions read_api access but this provides insufficient permissions to add the comments in the MR overview and fails. I can get it working by providing full api access but is there a way to configure the read_api access to allow comments in gitlab?

  2. My server is not running on localhost, let’s assume it is running at https://example.com/sonarqube. The decorator comment being added to MRs is generating the links as http://localhost:9000/sonarqube instead of https://example.com/sonarqube. Where can I fix this?
    Example link in comment:
    http://localhost:9000/sonarqube/project/issues?id=example&pullRequest=22&resolved=false&types=BUG

Hi, you need to register your public sonarqube address in SonarQube admin settings, on “general”, sonar.core.serverBaseURL properties. During the next decoration, you will have the correct links :slight_smile:

Hi Pierre, thanks! I am getting the proper links, I just need to fix the read_api permissions now :slight_smile:

@pierreguillot @vfronterotta do you guys happen to know why in the screenshot the images don’t show up properly?

Hi Zack, did you try what I suggest previously?

I updated the sonar.core.serverBaseURL parameter in the general configuration to the gke load balancer service’s IP address. Is domain name required for it? Also, should I include :9000 at the end?

How do your users access your SonarQube instance?