How Do You Get the Sonar Scanner Tool to Be Reinstalled on a Jenkins Slave?

Problem scenario
You want to uninstall the Sonar Scanner CLI to force its reinstallation as you have a Jenkins job that does the installation automatically.  What do you do to uninstall it and make the Jenkins job do the installation again?

1.  For the Sonar Scanner job that will run, configure it so it runs on a specific slave.  Log into Jenkins.  Go to the Jenkins job, go to Configure, and search for the word "Restrict".  Check the box near this word.  For the "Label" field, type in the hostname of the Linux server that has Sonar Scanner.

2.  Go to "Manage Jenkins".  Go to "Global Tool Configuration".   Go to SonarQube Scanner Installations.  Look at the "Name" field.  Remember the value.

3.  Log into the back end of the Jenkins slave that has Sonar Scanner installed.  Run this command but replace "foobar" with the value found in step #2:  sudo find / -name foobar | grep SonarRunnerInstallation

4.  Move the directory (e.g., /home/jenkins/jenkins_slave/tools/hudson.plugins.sonar.SonarRunnerInstallation/contint) that was found above to your user's home directory or somewhere in a completely different path (e.g., /tmp/).

5.  Re-run the Jenkins job.  The installation should be triggered from the absence of the directory on the slave server as Jenkins has a "remote directory" to look for.

Leave a comment

Your email address will not be published. Required fields are marked *