Upgrade SonarQube-Runner and Jenkins

JenkinsUpgradeI updated my version of SonarQube int the post SonarQube Upgrade 4.0, which was an opportunity to document some errors encountered.

I also wanted to updater other components such as the SonarQube-Runner and Jenkins and Mr. Jenkins caused me some problems.

So this post will allow us to see an upgrade of the SonarQube-Runner and Jenkins, as well as solve (or avoid) the errors encountered.

Jenkins Upgrade

After completing the upgrade of SonarQube in 4.0, I went into the portal Jenkins to run an analysis. I noticed at that time that there was a new version of Jenkins, so I decided to take the opportunity to also update it.

But this time, instead of installing Jenkins as a Windows service, as we have seen there a few times ago, I thought it would be an opportunity to install Jenkins with a Windows install, I mean, from an installation executable.

So I went on the Jenkins site in order to download the Windos native DownloadJenkinsWindowspackage, a zipped file ‘jenkins-1.541.zip’.

InstallJenkinsSetupAfter we unziip it, we now have a ‘setup.exe’ file and a ‘jenkins-1.541.msi’ install file.

I will check that the current Jenkins service is stopped. And I will launch the ‘setup.exe’. The install – in fact the update of the Windows service Jenkins – goes trough different steps: ‘Installing’, ‘Validating install’, ‘Starting service’, … I’ll spare you the details.

I know that the service has been updated for the good reason that … it does not start. Well, I got the same error that we met during our first install of Jenkins as a Windows service, which is that I need to change the Windows user in order to start the service correctly.

Once done , the Jenkins service starts without a problem, but against impossible to display the portal Jenkins at its usual url http://localhost:8080/. I see a strong activity of my computer from the Windows Task List, a Java process that takes a lot of CPU, continuously.

I waited patiently, I stopped / started Jenkins several times, and even rebooted my computer, but nothing happens. In fact, navigating through the various Jenkins logs, I discovered that a library was missing (a .jar file) so there was no possible way to get a correct functioning of the Jenkins webapp. Although the Señor Jenkins tried to launch continuously in an unsuccessful loop and without any message of explanation of what it was doing.

So I ended up uninstalling the Jenkins application using the same procedure as in the post about installing Jenkins as a Windows service, from a war file. Thus, I will not detail again this installation, but simply list the main steps:

  1. Download the ‘jenkins.war’ file from the Jenkins site.
  2. Launch Jenkins from a DOS windows with the command java -jar jenkins.war.
  3. In the Jenkins portal that opens at the url http://localhost:8080/, goes to the menu ‘Manage Jenkins’, then ‘Install as Windows service’.
  4. Follow the procedure of installation and once Jenkins is installed (or updated) as a Windows service, I have to modify the Windows user by default, with one with enough rights to start Jenkins. This step is probably specific to my laptop, it should be optional for a server installation of Jenkins.
  5. Then I change the configuration of Jenkins in the file ‘jenkins.xml‘) to make it point to my current repository, and recover all existing analysis jobs.

And then, finally, I can start Jenkins.

SonarQube is missing

Well, maybe I can start Jenkins but no SonarQube analysis job is running. I launch it and nothing happens.Not even an error message. I go to check the installed plugins and the SonarQube plugin is present in my current configuration. However, when I go to the configuration page of Jenkins (menu ‘Manage Jenkins’), the part corresponding to the settings of SonarQube is not there.

I spent a lot of time and it took me several failed attempts (including a re-install of the plugin SonarQube which resulted in the loss of the configurations of my analysis) before discovering the error. I do not know how it could happen, if it comes from the unsuccessful installation of Jenkins with a native Windows package, or simply a bad manipulation on my part, but the plugin ‘Maven Integration’ was disabled and this is what did cause that SonarQube became invisible. As I am not a Maveniste, it may well be that I disactivated this plugin without remembering it.

JenkinsMavenIntegrationPlugin

I did reactivate it and my SonarQube configuration did come back at it was originally. (see the posts about installing SonarQube as a Windows service, and installing the SonarQube plugins for Jenkins).

SonarQube-Runner upgrade

The update SonarQube Runner has not been a problem. So again, I will resume the main steps (as seen in the post about the installation of SonarQube-Runner):

  1. Download the SonarQube Runner installation file from the page Installing and Configuring SonarQube Runner, in the 2.3 version in my case (at the date of this post).
  2. Unzip this file into a directory ‘sonar-runner-2.3’.
  3. Modify the configuration file ‘sonar-runner.properties’ in order to indicate the localisation of SonarQube and of our Oracle database.

JenkinsSonarRunnerInstallationIn Jenkins, we go back to the configuration page (menu ‘Manage Jenkins’) and opten the section dedicated to the SonarQube-Runner configuration. Just specify the location of this new version and that’s it.

JenkinsSonarRunnerInstallation2

Et voilà ! I can resume my analysis, all with a full up-to-date environment with SonarQube the SonarQube Runner and Jenkins.

Last tip: if you lost the configuration of a job analysis in Jenkins, you can retrieve it from a backup of your repository.

JenkinsJobConfigXMLThe analysis are located in the ‘Jobs’ folder, with a subdirectory for each analysis. Where you will find a config.xml file with the configuration of the job, as for example the different SonarQube properties I indicate as parameters of the analysis.

Conclusion

I must say that I did not try to investigate furthermore the origin of the errors I have encountered?. But in conclusion, we can say that:

Installing the Windows Jenkins service from a file. War seems more stable, although less natural than from a setup executable (setup.exe deviation).
If the configuration SonarQube disappeared from Jenkins configuration page, verify that you have the plugin ‘Maven Integration installed. Do not ask me why, I do not use Maven.

  • Installing Jenkins as a Windows service from a .war file seems more stable, although less natural than from a setup file.
  • If the SonarQube configuration disappeared from the Jenkins configuration page, verify that you have the plugin ‘Maven Integration’ installed. Do not ask me why, I do not use Maven.

Too bad that no error message tells us that it is not possible to perform an analysis, as Jenkins does not know how to locate SonarQube. But at least now, if this error occurs, we know how to correct it.

And finally, we have also seen how to retrieve the Jenkins configuration of our analysis jobs. And our environment is completely up-to-tade. Well, that was worth a post!

One thought on “Upgrade SonarQube-Runner and Jenkins

Leave a Reply to AIR Cancel reply

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