How to use SonarQube with Jenkins pipeline?


(Vitaly Karasik) #1

I have Jenkins 2.150 with SonarQube Scanner for Jenkins 2.8.1 and started SonarQube 7.4 docker container on Jenkins master.
I’m trying to follow https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins and add SonarQube under Jenkins Global tools configuration. Something is going wrong, I don’t see SonarQube configured.
And Jenkins job fails with "hudson.remoting.ProxyException: hudson.AbortException: SonarQube installation defined in this job (Sonarqube-3.2.1) does not match any configured installation. "

Relevant part of Jenkinsfile:

stage(‘SonarQube analysis’) {
withSonarQubeEnv(‘Sonarqube-3.2.1’) {
sh ‘./gradlew -Pprod clean test sonarqube’
}
}

In fact, I think I’m missing something in Jenkins-SonarQube integration: why we need to add SonarQube installation into Jenkins Global tool config at all?
I already have sonar.host.url configured in the sonar.gradle.

TIA,
Vitaly


(Vitaly Karasik) #2

Answering my own question - I didn’t add Sonar into Jenkins “Configure System”.

Moderator - you’re welcome to delete this thread.