Difference between revisions of "CI/SonarQube"

From OpenMBD
< CI
Jump to: navigation, search
Line 48: Line 48:
  
 
For SonarQube:
 
For SonarQube:
 
  
 
To log in the first time in the SonarQube server, for "Login" type admin and for "password" type also admin, as show in the picture below.
 
To log in the first time in the SonarQube server, for "Login" type admin and for "password" type also admin, as show in the picture below.

Revision as of 12:35, 1 November 2017


Back to Home


SonarQubeLogo.png

Introduction to SonarQube

SonarQube is a continuous inspection program that analysis bugs, smelss and security in code. SonarQube can inspect more than 20+ programming language, like JavaScript, C/C++, Python, et cetera. It can show history of codes and providing graphs. The nice thing of SonarQube is that it can fully automate analysis and integration with continous integration tools, like Jenkins.

The Quality Gate is very important. This provides whether the application is ready to be launched or not, because of the quallity of the application.


Installation

The following steps must be followed to install SonarQube and SonarQube Scanner.

For SonarQube:

In Command Prompt go to the map where SonarQube is installed and start the service, for example:

C:\Program Files\SonarQube\sonarqube-5.6.6\bin\windows-x86-64>StartSonar.bat

If the service is up, SonarQube is installed properly.

Cmdsq.png

This can be checked by the following link: SonarQube.

On the picture below, on the left side of the screen it shows that the SonarQube server is successfully started.

Localhost9000.png


For SonarQube Scanner:

The following link can be used to install SonarQube Scanner: SonarQube Scanner.

To download SonarQube Scanner click on "Windows 64 bit" and the download will start after clicking on "Ok".

SonarQubeScanner.png


Configuration

For SonarQube:

To log in the first time in the SonarQube server, for "Login" type admin and for "password" type also admin, as show in the picture below.

SonarQubeLogin.png

Now the password can be changed and the token can be made, by clicking on the log in name in the upper right corner (see picture below) and click on "My account".

SonarQubePassword.png

Then go to "Security" and now the password can be changed (see picture above). After that, the token can be made by typing a name in block "Enter Token Name" and then click on Generate. Then there will be a code that must be copied and pasted in "Server authentication token" in Jenkins, in the configuration of SonarQube server. An example of the SonarQube token (with the code) can be seen in the picture below.

SonarQubeToken.png


To change the default port, under the header "WEB SERVER" in the file "sonar.properties" in the map of SonarQube, the # must be removed and now the "sonar.web.port" can be changed, for example to 5900.

Sonar web port.jpg

Next go to the homepage of the SonarQube server and click on "Administration".

SonarQubeGeneral.png

Now the "CI server" needs to be filled in, this is the continuous integration server URL. Then the "SCM server" needs to be filled in. Here the URL of the repository needs to be filled in, an example can be seen in the picture below.

RepositoryURL.png

Now going further with the configuration by clicking on "Java". By "File suffixes" type in .java.

SonarQubeJava.png


The configuration of SonarQube is now done.


For SonarQube Scanner:

To configure the settings of SonarQube Scanner follow the steps by using this link. These settings must be filled in the project settings in Jenkins (see "Execute SonarQube Scanner").