gitlabsonarqube

Sonarqube integration not working with Gitlab


In Sonarqube, I am attempting to integrate my gitlab instance with sonarqube. To do so, I go to the “DevOps Platform Integrations” section of Sonarqube. For gitlab, I specify the configuration name, Gitlab API URL, and a personal access token.

In “General”, the Server base URL is specified, as well to the Sonarqube website.

I keep getting the response “Could not validate Gitlab URL. Got unexpected answer.” When checking the configuration.

I want to be able to import repositories from my custom Gitlab domain I have up and running with projects. How do I resolve this issue?

I followed this guide: https://docs.sonarsource.com/sonarqube-server/latest/devops-platform-integration/gitlab-integration/global-setup/


Solution

  • The issue is most likely a broken certificate trust chain. To fix the issue:

    1. Pull the cert chain

    openssl s_client -connect <gitlab-URL>:443 -servername <gitlab-URL> -showcerts </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > certchain.pem

    1. Create a new trust store with this certificate

    keytool -import -file certchain.pem -alias customalias -keystore custom.truststore -storepass changeit

    1. Copy this trust store to <JAVA_HOME>/lib/security/cacerts.