{"id":1348,"date":"2014-12-15T16:19:36","date_gmt":"2014-12-15T15:19:36","guid":{"rendered":"http:\/\/qualilogy.com\/en\/?p=1348"},"modified":"2014-12-15T18:22:24","modified_gmt":"2014-12-15T17:22:24","slug":"sonarqube-upgrade","status":"publish","type":"post","link":"http:\/\/qualilogy.com\/en\/sonarqube-upgrade\/","title":{"rendered":"SonarQube upgrade"},"content":{"rendered":"<p><a href=\"http:\/\/500px.com\/Vicken\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2296\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Upgrade.jpg\" alt=\"Upgrade SonarQube\" width=\"288\" height=\"360\" \/><\/a>It&#8217;s been a long time since I updated my SonarQube environment. Six months or more, I&#8217;m still in version 4.2, while the latest version is a 4.5.1 LTS (Long Term Support). Therefore a good candidate for installation.<\/p>\n<p>This article <a href=\"http:\/\/www.sonarqube.org\/walking-the-tightrope-balancing-agility-and-stability\/\" target=\"_blank\">Walking the Tightrope: Balancing Agility and Stability<\/a>\u00a0on the blog SonarSource describes the aims and objectives of such a version.\u00a0This 4.5.1 release not only offers corrections but also\u00a0<a href=\"http:\/\/www.sonarqube.org\/new-lts-version-sums-impressive-array-of-new-features\/\" target=\"_blank\">many changes and new features<\/a>.<\/p>\n<p>This is not the first post I write about a SonarQube upgrade, you will find them all together under this part <a href=\"http:\/\/qualilogy.com\/en\/category\/sonar\/sonar-installation\/\" target=\"_blank\">SonarQube &#8211; Installation<\/a> on my blog. This article will be more concise, with referrals to these previous and detailed posts, when needed. <!--more--><\/p>\n<h2>Action plans<\/h2>\n<p>I take my time to do an upgrade (especially that I don&#8217;t do that so often) because there is, if not a procedure, but at least a plan to follow. Starting with what I call <a title=\"SonarQube upgrade \u2013 Prerequisites\" href=\"http:\/\/qualilogy.com\/en\/sonarqube-upgrade-prerequisites\/\" target=\"_blank\">the prerequisites<\/a>.<\/p>\n<p>I start by looking at what&#8217;s new and, above all, I check the <a href=\"http:\/\/docs.sonarqube.org\/display\/SONAR\/Upgrading\" target=\"_blank\">upgrade documentation<\/a> because even if I know it well, even if I can refer to a previous article on my blog, this process may vary and it did happen that I get an error for not following carefully these requirements. The installation or the update of SonarQube is not automatic, it is not a click on an executable to implement the software, there are some manual steps.<\/p>\n<p>Besides these <a href=\"http:\/\/docs.sonarqube.org\/display\/SONAR\/Release+4.5+Upgrade+Notes\" target=\"_blank\">Upgrade Notes for version 4.5<\/a> list possible impacts on my SonarQube environment, the different analysis and projects in my repository, their configurations, and especially the potential conflicts with previous versions of\u00a0plugins. For instance, I can see that I must remove the Technical Debt plugin \u2013 you know, the SQALE plugin that I use in all my tests \u2013 prior to installing this new version of SonarQube.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UninstallTD.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2310\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UninstallTD.jpg\" alt=\"SonarQube Upgrade 4.5.1\" width=\"675\" height=\"110\" \/><\/a><\/p>\n<p>The SonarQube Update Center also gives me a global overview of the various plugins to update.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Admin_Settings.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-2311\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Admin_Settings.jpg\" alt=\"SonarQube_Admin_Settings\" width=\"200\" height=\"53\" \/><\/a>In order to acces it, I log as an Admin, and then the &#8216;Settings&#8217; menu brings me to the page with the same name, <a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_MenuUpdateCenter.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2313\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_MenuUpdateCenter.jpg\" alt=\"SonarQube_MenuUpdateCenter\" width=\"158\" height=\"180\" \/><\/a>in which I select the &#8216;Update Center&#8217; menu (in the left menu bar) to go into in the same page &#8216;Update Center&#8217; with different tabs. We first start with the tab &#8216;System Updates&#8217; which allows me to check that:<\/p>\n<ol>\n<li>I can directly upgrade my installed version 4.2 to the latest version 4.5.1 without going through an intermediate version. Great!<\/li>\n<li>The upgrade procedure consists in a prior upgrade of some plugins before &#8230;<\/li>\n<li>&#8230; Installing the SonarQube 4.5.1 release.<\/li>\n<\/ol>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdateCenter_SystemsUpdate.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2315\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdateCenter_SystemsUpdate.jpg\" alt=\"SonarQube Update Center\" width=\"759\" height=\"271\" \/><\/a><\/p>\n<p>But first, the last pre-requisite: a backup of the Oracle user (schema) Sonar. I did describe previously <a title=\"SonarQube upgrade \u2013 Prerequisites\" href=\"http:\/\/qualilogy.com\/en\/sonarqube-upgrade-prerequisites\/\" target=\"_blank\">the complete procedure<\/a>.<\/p>\n<h2>Plugins upgrade (1)<\/h2>\n<p>I begin by updating the plugins listed above by clicking on the &#8216;Upgrade&#8217; for each of them &#8230; and get an error message:<br \/>\n<a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_ErrMsg1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2319\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_ErrMsg1.jpg\" alt=\"SonarQube_UpdatePlugin_ErrMsg1\" width=\"519\" height=\"37\" \/><\/a>Well, it&#8217;s like the dog chasing it&#8217;s tail: the tab &#8216;System Updates&#8217; told me to upgrade some plugins before a SonarQube upgrade, but when I try to follow these instructions, this message indicates to me that we must first update the version of SonarQube before updating the plugins.<br \/>\nMoreover, this is what is clearly indicated in the tab &#8216;Plugin Updates&#8217;:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdateCenter_PluginsUpdate.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2320\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdateCenter_PluginsUpdate.jpg\" alt=\"SonarQube_UpdateCenter_PluginsUpdate\" width=\"815\" height=\"182\" \/><\/a><\/p>\n<p>I tried to download and install a new version of the &#8216;Developer Cockpit&#8217; plugin in the corresponding directory\u00a0\u2018..\\Sonar\\sonarqube-4.5.1\\extensions\\plugins\u2019, then a Restart of the Sonar service, but unsuccessfully:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_ErrMsg2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2321\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_ErrMsg2.jpg\" alt=\"SonarQube_UpdatePlugin_ErrMsg2\" width=\"903\" height=\"50\" \/><\/a><\/p>\n<p>The log \u2018..\\Sonar\\sonarqube-4.5.1\\logs\\sonar.log\u2019 clearly tells me that I can not work with this version of this plugin for this version of SonarQube. In fact, this is the Upgrade Notes to version 4.5 that must be followed, so once again: always consult it before any action. I&#8217;ll remove the Technical Debt plugin, the only one deprecated in my environment (according to these notes), before installing the new version of SonarQube.<\/p>\n<h2>SonarQube upgrade<\/h2>\n<p>Detailed instructions can be found in a previous post <a title=\"SonarQube Upgrade 4.0\" href=\"http:\/\/qualilogy.com\/en\/sonarqube-upgrade-4-0\/\" target=\"_blank\">SonarQube Upgrade 4-0<\/a>. So I&#8217;ll list them briefly, unless we find anything new and different.<\/p>\n<ol>\n<li>Stop the current (4.2) Sonar service.<\/li>\n<li>Backup of the current SonarQube directory (\u2018..\\Sonar\\sonarqube-4.2\u2019), for safety.<\/li>\n<li>Download of the \u2018sonarqube-4.5.1.zip\u2019 file from the <a href=\"http:\/\/www.sonarqube.org\/downloads\/\" target=\"_blank\">Download page<\/a>.<\/li>\n<li>Delete of the existing Sonar service with the file \u2018..\\Sonar\\sonarqube-4.2\\bin\\windows-x86-64\\UninstallNTService.bat\u2019. Obviously, choose the directory for your operating system (Windows 7 64-bit for me).<\/li>\n<li>Copy of the plugins from the previous version to the new version, so from \u2018..\\Sonar\\sonarqube-4.2\\extensions\\plugins\u2019 to \u2018..\\Sonar\\sonarqube-4.5.1\\extensions\\plugins\u2019.<br \/>\n<strong>Note<\/strong>: for this particular installation of the 4.5.1 release, I will not copy the plugin Technical Debt, since it is deprecated and should be removed from the plugins directory, as described above.<\/li>\n<li>Copy of the Oracle driver \u2018ojdbc6.jar\u2019 to the new directory \u2018..\\Sonar\\sonarqube-4.5.1\\extensions\\\\jdbc-driver\\oracle\u2019.<\/li>\n<li>As indicated on the <a href=\"http:\/\/docs.sonarqube.org\/display\/SONAR\/Upgrading\" target=\"_blank\">SonarSource upgrade page<\/a>, I update the configuration file \u2018..\\Sonar\\sonarqube-4.5.1\\conf\\sonar.properties\u2019 with the characteristics of my environment, principally the address of my Oracle database. We could do the same with the file\u00a0\u2018wrapper.conf\u2019 (for the JVM configuration), but I prefer to start with the default configuration and possibly consider some adjustments in case of problems.<\/li>\n<\/ol>\n<p>Changes in the file &#8216;sonar.properties&#8217; are typically as follows:<\/p>\n<ul>\n<li>Oracle user for the Sonar scheme: these lines are already commented in the file. So just quit the sign &#8216;#&#8217; in front of it.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Properties1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2323\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Properties1.jpg\" alt=\"SonarQube properties\" width=\"401\" height=\"90\" \/><\/a><\/p>\n<ul>\n<li>Connection address to my Oracle database. <a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Properties2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2325\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Properties2.jpg\" alt=\"SonarQube_Properties2\" width=\"523\" height=\"54\" \/><\/a><\/li>\n<\/ul>\n<p>Okay. I can now start the installation of the new service for this SonarQube version with the file \u2018..\\Sonar\\sonarqube-4.5.1\\bin\\windows-x86-64\\\u2018InstallNTService.bat\u2019. Again, choose the folder that corresponds to your OS.<\/p>\n<p>Ok. Installation performed correctly:<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_MsgInstall.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2327\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_MsgInstall.jpg\" alt=\"SonarQube_UpdatePlugin_MsgInstall\" width=\"608\" height=\"60\" \/><\/a><\/p>\n<p>The new service &#8216;SonarQube&#8217; (and not &#8216;Sonar&#8217; as in the previous version 4.2) appears in the list of the Windows services.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_InstallNewService.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2328\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_InstallNewService.jpg\" alt=\"SonarQube_InstallNewService\" width=\"447\" height=\"33\" \/><\/a><\/p>\n<p>And when I run it, I get an <a title=\"SonarQube as a Windows service with Jenkins under Tomcat\" href=\"http:\/\/qualilogy.com\/en\/sonarqube-windows-jenkins-tomcat\/\" target=\"_blank\">error message<\/a> already met in a previous upgrade. The problem is that the account &#8216;Local System&#8217; attempts to start the service, which does not work on my laptop. May be you won&#8217;t have this problem for a server installation, but if that&#8217;s the case on your own computer, follow the steps in <a title=\"SonarQube as a Windows service with Jenkins under Tomcat\" href=\"http:\/\/qualilogy.com\/en\/sonarqube-windows-jenkins-tomcat\/\" target=\"_blank\">this post<\/a> to change the user launching the service.<\/p>\n<p>I start the service, then SonarQube: http:\/\/localhost:9000\/ (default url). We go on the maintenance page.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Maintenance.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2329\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_Maintenance.jpg\" alt=\"SonarQube maintenance page\" width=\"670\" height=\"96\" \/><\/a><\/p>\n<p>This is correct, we still have to proceed with the last step: the upgrade of the database from the setup page: http:\/\/localhost:9000\/setup.<br \/>\nThis may take some time, depending on the data in your repository SonarQube, that is to say the number and size of your projects.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_DBUpdate.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2331\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_DBUpdate.jpg\" alt=\"SonarQube_DBUpdate\" width=\"671\" height=\"91\" \/><\/a><\/p>\n<p>Ultimately, SonarQube tells us that the database is updated correctly. This is the signal that our version upgrade has worked (at least, until we start an analysis).<\/p>\n<h2>Plugins upgrade (2)<\/h2>\n<p>Now that my version of SonarQube is up to date, I can proceed with the upgrade of the plugins, from the tab\u00a0\u2018Plugin Updates\u2019, by clicking on all buttons of upgrade to the latest version for each of the plugins.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugins.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2332\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugins.jpg\" alt=\"SonarQube_UpdatePlugins\" width=\"462\" height=\"309\" \/><\/a><\/p>\n<p>Unfortunately, this does not work, I get an error message about the plugin &#8216;surefire&#8217;, which must be fully compatible with the &#8216;java&#8217; plugin version.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_ErrMsg3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2333\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdatePlugin_ErrMsg3.jpg\" alt=\"SonarQube_UpdatePlugin_ErrMsg3\" width=\"897\" height=\"56\" \/><\/a>And when I remove it from the plugins directory, the upgrade is interrupted again with another error message about the plugin &#8216;jacoco&#8217;, then &#8216;squid&#8217; &#8230; even though these plugins are not present in the list above.<\/p>\n<p>Actually, and again, we must first of all visit the plugins page to check for Upgrade Notes, as this is the case for the various Java plugins <a href=\"http:\/\/docs.sonarqube.org\/display\/SONAR\/Java+Plugin\" target=\"_blank\">http:\/\/docs.sonarqube.org\/display\/SONAR\/Java+Plugin<\/a>.<\/p>\n<p><a href=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdateMsg4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-2335\" src=\"http:\/\/qualilogy.com\/fr\/wp-content\/uploads\/sites\/2\/2014\/12\/SonarQube_UpdateMsg4.jpg\" alt=\"SonarQube_UpdateMsg4\" width=\"322\" height=\"102\" \/><\/a>I follow the instructions listed on this page and remove the listed plugins, and then the upgrade of the other plugins works Ok without error. I can then reinstall the Java plugins easily.<\/p>\n<h2>Synthesis<\/h2>\n<p>So as a summary, some important points to note:<\/p>\n<ul>\n<li>Prerequisites: always look at the Releases or Upgrade notes, and not only for SonarQube but also for the plugins that you wish to update.<\/li>\n<li>The Update Center is very valuable to get a global and precise view of the installed plugins and the new versions, and thus prepare the upgrade procedure.<\/li>\n<li>The Update Center does not always allow to automatically upgrade: some preliminary steps, such as a manual removal of a version of some plugins, are sometimes necessary, as we have seen above.<\/li>\n<\/ul>\n<p>Our SonarQube environment is now updated. I am eager to see the new quality rules for SAP (ABAP) and Cobol code. In a future post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a long time since I updated my SonarQube environment. Six months or more, I&#8217;m still in version 4.2, while the latest version is a 4.5.1 LTS (Long Term Support). Therefore a good candidate for installation. This article Walking the Tightrope: Balancing Agility and Stability\u00a0on the blog SonarSource describes the aims and objectives of [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1348","post","type-post","status-publish","format-standard","hentry","category-sonar-installation"],"_links":{"self":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/1348"}],"collection":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/comments?post=1348"}],"version-history":[{"count":29,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/1348\/revisions"}],"predecessor-version":[{"id":1377,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/posts\/1348\/revisions\/1377"}],"wp:attachment":[{"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/media?parent=1348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/categories?post=1348"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/qualilogy.com\/en\/wp-json\/wp\/v2\/tags?post=1348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}