I'm looking to install sonarQube on our jenkins server.
The documentation i can find tells me to configure sonar-runner in
Jenkins --> manage Jenkins --> Configure system
however there is no 'sonar runner' option there.
There is a 'sonar' option where i configured my sonar server, and the sonar plugin is installed and up to date.
How do i get the sonar-runner configuration to show up?
(We want the standalone sonar job not the maven on as this is a project without maven.)
In newer versions of Jenkins (like 2.2), the sonarqube runner configuration is under
Manage Jenkins > Global Tool Configuration
Thats the solution :)
Ok. So, if I understand well:
Going into Manage Jenkins' -> 'Manage Plugin' -> tab 'Installed' in the Plugin manager, you can see 'Jenkins Sonar plugin' in the installed plugins.
--> Beware that there is a SonarGraph plugin that is not the proper one. Please verify you have this: http://i.stack.imgur.com/SNZLG.jpg
You say you can install the sonar server part in Jenkins. I understand you refer to this doc http://docs.codehaus.org/display/SONAR/Configuring+SonarQube+Jenkins+Plugin#ConfiguringSonarQubeJenkinsPlugin-AddingSonarQubeServer, and more specifically section 'Adding SonarQube Server' point 2 and 3.
--> Can you confirm that you have this 'Sonar' part under you Jenkins configuration ?
If yes to previous 1 & 2, you should also have the SonarQube Runner part available in Jenkins, as in the previous doc and the post on my blog.
--> Can you confirm this is the part that is lacking ?
Can you try this:
Jenkins -> New Job -> Select 'Build a free-style software project', enter a job Name -> click Ok.
Section Build -> 'Add build Step': can you see the 'Invoke standalone Sonar analysis' menu : http://i.stack.imgur.com/9TmFr.jpg ?
You have SonarQube runner installed and correctly configured: http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runnerhttp://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner
Do not hesitate to ask for further precision.
I can see both Sonar (just above E-mail Notification section) and Sonar Runner in Jenkins > Configure System section.
I have Jenkins 1.547 and Sonar Plugin 2.1 installed. However, please note that, as per this link, Jenkins 1.491+ and Sonar plugin 2.1 will suffice.
I faced similar issue.
Solution is that you need to run sonar-runner outside jenkins once and then restart jenkins.
To run sonar-runner outside jenkins. Download sonar-runner as mentioned in the steps #
http://docs.sonarqube.org/display/SONAR/Installing
Create a sonar-project.properties file at the root of you code base. below link describes the content of the file. http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Runner
Run sonar-runner.bat from the codebase.
Once the sonar analysis is done, Start Jenkins Jenkins will now show the sonar-runner option in configure page.
Related
I am trying to run the SonarQube Scanner within Jenkins as a post-build step. However, I keep getting the error message below:
------------------------------------------------------------------------
SONAR ANALYSIS FAILED
------------------------------------------------------------------------
FATAL: SonarQube Scanner executable was not found for SonarQube
Build step 'Execute SonarQube Scanner' marked build as failure
From similar questions on stackoverflow I read that one should choose "Install automatically" for the SonarQube Scanner, which I have done.
My configurations is as follows:
SonarQube 6.0
Jenkins 1.609.3
SonarQube Plugin 2.4.4
SonarQube Servers
SonarQube Scanner
Build-step
Make sure you are giving path in Global Tool Configuration correctly.
Give the path of folder in which bin folder is exists inside that folder.
Step1 : 1st find where the sonar_scanner bin is available -
root#test1sp117:/opt/sonar_scanner/sonar-scanner-3.0.3.778-linux# ls
bin conf jre lib
Step2 : Give the correct path in Manage Jenkins --> Global Tool Configuration --> SonarQube Scanner
You may want to ensure that both SonarQube and SonarQubeRunner are installed. You would need to configure the SonarQube Runner bin in the Tool Configuration of Jenkins and not the SonarQube server. This fix worked for us.
When you config SonarQube Scanner in Manage Jenkins --> Global Tool Configuration --> SonarQube Scanner, besides select "Install automatically", you also need to add a installer.
See screenshot here:
SonarQube Scanner --> Add Installer
I had integrated sonarqube with the jenkins by adding a plugging and changing the configuration. But after i build a project, the build is succeded but not analysis results are added to sonarqube UI. And I cannot click on SonarQube link in the project page after build. but if i run the sonarqube analysis without jenkins i get the results in the web UI.
the sonarqube was also injected to the build:
according to the console output.
Can you please help me to get my integration correct?
Best regads,
Nadis
Install SonarQube Runner and configure it with Jenkins under SonarQube Runner section (Go to Manage Jenkins ->Configure System).
For step by step information on "Configuring Sonar with Jenkins" follow this link.
As per the recent announcement on Gradle forum, the Sonar Plugin and Sonar Runner Plugin are being deprecated in favor of the SonarQube plugin. Can someone share any links (documentation or blogs) that demonstrate setting this up in Jenkins. I tried this on the local setup and gradle sonarqube task works great.
Should we continue to use the "Invoke Standalone Sonar Analysis" (from Jenkins-Sonar plugin) build step in a freestyle Jenkins job? With the default settings, it doesn't infer mandatory information like sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources from the build.gradle file. To provide it manually for a multi-module project is painful (particularly for sonar.libraries and sonar.binaries). One could think to generate a sonar-project.properties file as part of a custom gradle task that will subsequently be used by the Standalone Sonar analysis step.
However, it seems that this a generic requirement and I feel that there might be a simpler way out in in the Jenkins-Sonar plugin. Could someone familiar with the Jenkins-Sonar Plugin shed some light on it?
System info:
Gradle 2.5
Jenkins 1.560
SonarQube 4.5
SonarQube Gradle Plugin 1.0
Sonar Runner 2.3
Jenkins Sonar Plugin 2.2
JDK 1.8
Linux 2.6
Thanks in advance!
EDIT:
I did not want to put the database username and password of the remote sonarqube instance in my gradle build file and hence don't want to use the existing 'sonarqube' task.
I think that you are referring to the following improvement that we want to do on the Jenkins SonarQube plugin: SONARJNKNS-217
This should come sooner or later. In the meantime, you're right, there's no easier way than what you described - unfortunately.
I use Jenkins and plugin SonarQube and Sonar runner.
For SonarQube Runner installation in Jenkins, it made Warning like this.
/home/abc/sonnar-runner-2.4 is not a directory on the Jenkins master (but perhaps it exists on some slaves)
of course I made /home/abc/ directory on the Jenkins Server.
so.. i ignore the warning and try to build tho..
it made error like this.
SONAR ANALYSIS FAILED
FATAL: SonarQube runner executable was not found for sonar-runner-2.4
Build step 'Invoke Standalone SonarQube Analysis' marked build as failure
Finished: FAILURE
i cant figure out this problem
is there anyone know how to solve this?
When you config SonarQube Scanner in Manage Jenkins --> Global Tool Configuration --> SonarQube Scanner, besides select "Install automatically", you also need to add a installer.
See screenshot here:
SonarQube Scanner --> Add Installer
I am using Maven as a build tool and Jenkins as a CI tool. Currently I have a Jenkins job configured with a Maven build step.
I started using SonarQube and was wondering what is the advantage of using the Jenkins SonarQube plugin and configuring the SonarQube analysis as a post-build-action over simply adding sonar:sonar to the goals of my existing Maven build step.
Thanks and best regards,
Ronald
You can save a lot of configuration. So, if you use jenkins sonar plugin you can centralize database credentials and sonar credentials but if you make a decision about execute sonar:sonar in each jenkins job you will configure each with the same credentials.
I just found: Why use sonar plugin for Jenkins rather than simply use maven goal "sonar:sonar"?
And to add one reason: Using the Jenkins SonarQube plugins one can specify "Skip if triggered by SCM Changes". This is nice if you trigger your Jenkins job for each commit but only want to do a SonarQube analysis at a scheduled time, e.g. one per night.
And here is a summary of the the points made by "emelendez":
Centralize database credentials and sonar credentials Use jenkins
Use jenkins sonar plugin configuring SonarRunner for non Java projects
I've just changed to maven-sonar-plugin from the Jenkins SonarQube plugin to avoid divergence of information between the pom.xml and sonar-project.properties.
For example, developers elsewhere had bumped the project version number in the pom.xml, but they don't use the Jenkins builds and didn't care about the sonar-project.properties (or probably understand it). By switching to the maven plugin instead, the project version is defined once and referenced in the sonar property set within the pom.
The downside is that I no longer have the SonarQube link from the project's Jenkins page.
I'm not sure where the responsibility might be for adding this link back for projects using maven-sonar-plugin... The link is "owned" by the Jenkins SonarQube Plugin, but this is not being used here. Meanwhile the maven-sonar-plugin component is integrating with maven not Jenkins.
Something would need to observe the build and extract the SonarQube link which is emitted as a [INFO] ANALYSIS SUCCESSFUL, you can browse http://... line in the log.