Chapter 10.  Integration with Jenkins

With Jenkins Sonargraph Integration Plugin for Jenkins jobs the findings of Sonargraph can be used to let builds fail, or mark them unstable. Additionally Sonargraph metric values are stored for every build and can be visualized as charts.

10.1. Jenkins Server Configuration

The first step is to configure one or more versions of Sonargraph Build in "Manage Jenkins""Configure System". Click "Sonargraph Build installations..."

Jenkins - Sonargraph Build Configuration
Figure 10.1. Jenkins - Sonargraph Build Configuration


and select a name, a version and an installer.

Jenkins - New Sonargraph Build
Figure 10.2. Jenkins - New Sonargraph Build


10.2. Jenkins Job Configuration

Add post build action "Sonargraph Integration Report Generation & Analysis" to your job.

Job - Post Build Action
Figure 10.3. Job - Post Build Action


First decide if Sonargraph Build is used to create the report,

Report - Generate With Sonargraph Build
Figure 10.4. Report - Generate With Sonargraph Build


or there already exists a report generated by an upstream build action.

Report - Pre Generated
Figure 10.5. Report - Pre Generated


When Sonargraph Build is used to create the report fill out all required information:

Report - Standard Options
Figure 10.6. Report - Standard Options


By pressing "Advanced..." some more options pop up:

Report - Advanced Options
Figure 10.7. Report - Advanced Options


10.3. Charts Configuration

To see some charts, a meta-data file must be configured, and either all contained charts/metrics are shown, or a list of charts/metrics to be shown can be given. If you want to track custom metrics that are generated via scripts, you first need to export the report meta-data via the standalone application's menu "File""Export Meta-Data...".

Job - Chart Configuration
Figure 10.8. Job - Chart Configuration


Job - Select Charts
Figure 10.9. Job - Select Charts


10.4. Build Configuration

Finally the reasons for marking the build as failed or unstable can be set:

Mark build failed or unstable
Figure 10.10. Mark build failed or instable


Related topics:

  • See the section about "Workspace Profiles" in the user manual of the standalone application, if the root directories on your build server do not match the workspace definition.

  • Chapter 6, Integration with Maven