Link from Jenkins Pipeline page to SonarQube - jenkins

I've set up a multi-branch pipeline in Jenkins which performs a SonarQube analysis using the withSonarQubeEnv() step and the sonar:sonar Maven goal.
This works fine, and the analysis results do show up in SonarQube.
What I'm missing (compared to the traditional non-pipeline Jenkins integration) is a clickable link on the Jenkins build page which will open the analysis results in SonarQube.
There is a small SonarQube icon next to every build in the left panel, but this icon is not clickable.
Is there any configuration switch that will produce a clickable link, or is this simply a missing feature?

As far as I know Once the job is complete, the plugin will detect that a SonarQube analysis was made during the build and display a badge and a widget on the job page with a link to the SonarQube dashboard as well as quality gate status.
Please refer this and verify your configurations.
If this is happening to you, verify that the test is actually running if not, verify your configuration.

You are probably looking for the SonarQube link on the build job page (for example job/foo/1/). However the link is on the project pate (that is job/foo). There you will find one link on the menu to the left and a SonarQube Quality Gate widget in the bottom center.
Menu
Widget

Related

Stop Overwriting SonarQube Existing job results

I am running a job through Jenkins with the SonarQube Execute Scanner Plugin.
These are all my Analysis Properties
sonar.projectKey=Project1
sonar.projectName=ProProject
sonar.projectVersion=Layer1
sonar.verbose=true
sonar.sources=src
sonar.qualitygate=SonarQube way
sonar.libraries=lib
sonar.tests=Tests
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
sonar.includePlugins=views,report,buildbreaker
sonar.analysis.mode=publish
sonar.issuesReport.console.enable=true
sonar.sourceEncoding=UTF-8
When I try to view SonarQube results for my sonar jobs, I see that the result of previous job is being overwritten with the new job.
I am loosing my previous job result
That's the default behavior of this plugin and of SonarQube. If you want to see changes over time in your project's code quality and issues (UI of SonarQube 5.6.2):
go to your SonarQube instance,
click on the name of the project you're interested it,
under the project name, there will be a menu: click on Dashboards -> TimeMachine.
You'll see graphs showing changes in the number of issues, lines of code, test coverage, and so on. In the top right, you should be able to choose a time frame you're interested in.

Jenkins integration with RCP product

I have an RCP product with a view. In the view, i want to show all the jenkins builds configured and should be able to download builds, view logs, trigger builds. is there any API available?
A quick search yielded the following result Jenkins Remote API. The sample code section has some details. Hope this helps

Auto-refresh for SonarQube Dashboard

I have some continious Integration running with Jenkins and some quality analysis with Sonar and Checkstyle.
I want to display them in real time in my open space.
My problem is when Jenkins run a new job, it update the Sonar analysis, but the sonar dashboard does not move. and we have to refresh the page (F5) in order to display the new analysis.
How can I force the sonar web page to refresh after each job ?
(using sonar 5.2)
And how can I set the Jenkins build instable when the quality is below a gate ? (or when I have more than x mjor issues ?)
For Jenkins, no problem : we will use the monitor view plugin
Afaik you can't force SonarQube to reload the page after each job. You have to do this by yourself.
Prior to 5.2 you could use the BuildBreaker Plugin, to handle quality gate violations. Unfortunately I don't know a solution for this in 5.2+ :(

Change: Quality Gate from Jenkins (sonar-runner)

I am using Jenkins to kick off Sonar-runner for analyzing projects.
Now I use the Build Breaker plugin.
This breaks a build when a quality gate is reporting that the quality is below/above given values.
I'd like to change the quality gate used by the Sonar-Runner, on a per-job basis in Jenkins.
Looking up at Analysis Parameters documentation:
**sonar.profile** parameter is to change the language to analyse
I would thought that for the gate: sonar.gate would work (it doesn't)
Question:
What parameter for sonar-runner has to be used to change the "Quality Gate"?
Used versions:
Jenkins 1.598
Sonar 4.5.1 (LTS)
The property is sonar.qualitygate.
It was not documented because this is generally not a good idea to change the quality gate that should be used during a standard analysis - but it's true that it can be useful with the build breaker on preview analyses.
I updated the documentation.
I tried above solution but it did not work for me. Finally I figured out that with new version of sonar-scanner we can achieve it only from Sonar-Qube UI.
Follow below steps:
Login to Sonar Quber server as administrator and select projects. Search for the project name you want to add the quality gate for. Select the searched project and below screen screen would appear.
Navigate to Administration > Quality Gates
Select the quality gate from the drop-down which you want to use for this project (A default quality gate is assigned by-default for all the projects).
Hope this helps. Thanks!

Jenkins manual Trigger for successful build

I need help with Jenkins.
I want trigger over an button in the already successful builded 'build' page (where the testresults, artefacts etc. are listed) one target in an ant script.
Is that possible over an plugin or do I have there to do more?
This is the closest I can see you can get at the moment.
A combination of the Jenkins Batch Task Plugin:
This plugin adds batch tasks that are not regularly executed to
projects, such as releases, integration, archiving, etc. In this way,
anyone in the project team can execute them in a way that leaves a
record.
and Sidebar-Link Plugin:
This simple plugin adds an Additional Sidebar Links section in the
main Jenkins configuration page, with settings for link URLs, texts
and icons. These links will be shown in the top-level Jenkins pages
(main page, user list, build history, My Projects and other project
view tabs). Sidebar links for particular jobs may also be added in the
job configuration pages.
You can use the Sidebar-Link Plugin to add these to the project page, but it doesn't appear to support adding it to the build page as of yet - might be worth raising a JIRA ticket and requesting this as it was part of the original ticket.
In the Batch Task Plugin you can define a task - that might well be an Ant invocation - this example is called 'release'.
Then you can run the task from the web interface:
And records of these post-build tasks are kept and accessible:

Resources