1 sonarqube server connected to 2 different jenkins server

508 views Asked by At

Currently have 1 jenkins (development) server connected to 1 sonarqube server. Now, I'd like to connect my 2nd jenkins (production) server to the same sonarqube server. Is this possible?

I've tried setting up my production server with the same sonarqube configuration settings and was able to successfully connect to sonarqube server using the deprecated sonarqube post build action. Since it's deprecated, I switched to enabling "Prepare SonarQube Scanner Environment" and "Invoke top-level maven targets". However it's failing for some reason when i tried to run the build.

Error: [INFO] The current batch process and the configured remote server do not share the same DB configuration. - Batch side: jdbc:postgresql://something.net/****** (****** / *****) - Server side: check the configuration at http://******.net:9000/system

Note: - sonar.code.id is the same value as URL/api/server - jenkins system configuration is the same as URL/system

2

There are 2 answers

0
user2446883 On

So i have 2 jenkins job. Both jenkins job are pointing to the same sonar server which was set under jenkins > manage jenkins > Configure System. Sonar build for both are invoked via jenkins. So here's the scenario :

Jenkins 1 : No issues, publishing it on the right server
Jenkins 2 :
        - if job configuration is to add post build action > SonarQube analysis with maven : it gets published to the right sonarqube
        - if job configuration is set to "Prepare SonarQube Scanner environment" and run "$SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN" -- fails for some reason since it's pointing to another sonar database. Really weird.

Could there be some areas where i need to check the configuration? So far i keep on checking Jenkins > Manage Jenkins > Configure system and the jenkins job configuration and the pom file which are both identical.

1
Eric Hartmann On

Yes, nothing prevents from connecting two Jenkins instances to the same SonarQube server.

According to your error message, the database configuration of your production server does not have the right configuration of your Postgresql server.

You should check that you have the same configuration on both Jenkins and SonarQube for Postgresql.

If it's not the case, please post the full log of the error.