Error integrating SonarQube into CI pipeline

I need help on solving this issue. Can anybody help me ??

I have installed sonarqube in /opt/sonar and configured in /opt/sonar/conf. I have also installed sonarscanner 4.2v in /opt/sonar-scanner folder,configured in /opt/sonar-scanner/conf. both of these scanner has = ‘http://MYVMIP:9000’ along with and web.port uncommented for respective values.
I have installed gitlab runner. confuigured cicd variables[SONAR_LOGIN,SONAR_PASSWORD].

/etc/profile.d has file that has path for both of the above files. ‘source /etc/profile.d/’. sonar.service file written in /etc/systemd/sytem. User has been added, permission is given.

NOTE : i have not installed Docker on my machine.

Sonar portal is accessible on http://MYVMIP:9000, but if i run my pipeline code
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [“”]
SONAR_USER_HOME: “${CI_PROJECT_DIR}/.sonar” # Defines the location of the analysis task cache
GIT_DEPTH: “0” # Tells git to fetch all the branches of the project, required by the analysis task
key: “${CI_JOB_NAME}”
- .sonar/cache
- sonar-scanner -X
allow_failure: true
- master
this is throwing error.

Please guide me


This does not look like a GitLab issue, this is purely a network problem (SQ CLI cannot reach SQ Server). You didn’t specify - are you using Runners or your own Runners?

You need to make sure that your GitLab Runners can reach your SonarQube instance via provided IP as well. For simple debugging you could e.g. try to curl your SQ instance from a Runner.

@paula.kokic Im not using available default runners of Gitlab. Im using self configured runners from gitlab.
Can please ellaborate on how to check connectivity from gitlab runner to SQ? I can access SQ rom the IP on which it is installed. But im unaware of checking it through gitlab runner. Pls share knowledge


Depends a bit what type of Runners you have and how did you install them.

Assuming you have a basic Runner installed using Linux packages on a single VM, you could ssh into that VM and try to curl your SQ server:

curl http://<your-sonarqube-instance-ip>:9000

Curl is happening from runner vm. Issue persists. Can we have runner and SQ installed on same VM? @paula.kokic

In theory, yes.

But GitLab recommends installing Runner on a dedicated VM. And I would advise you to do so as well. Otherwise you might have performance issues.

If you don’t have the same issue with curl, you could dig deeper with other network tools. Google is your best friend.

If you’re working in the company, I would advise you to get in contact with your Network/Security Team to check the configuration / requirements.

1 Like