Gitlab CI + SonarQube


I’m trying to set up my sonarqube server but it’s not working for some reason, in .m2/settings.xml I have specified


I’m trying to integrate it with GitLab, so, in my .gitlab-ci.yml I added

  stage: sonarqube-check
    SONAR_USER_HOME: ".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
      - .m2
    - 'mvn verify sonar:sonar -Dsonar.qualitygate.wait=true -s ci_settings.xml'
  allow_failure: true

But it’s still looking for the https://locahost:9000 and fails with

 SonarQube server [http://localhost:9000] can not be reached

What am I doing wrong? I don’t have experience with ci so I’m learning on the go

Thanks for help

Hey there.

This value is probably overriding everything. Is it set, and if so, to what value?

I’m not a Gitlab expert, but strictly following the UI tutorial in SonarQube when configuring GitLab CI, I don’t think you need SONAR_HOST_URL or SONAR_TOKEN defined in your .gitlab-ci.yml file, only under Settings > CI/CD > Variables

Hello, It doesn’t work if I remove it. I’m trying to read the value from maven settings.xml