{jenkins-plugin-info:pluginId=sonargraph-integration|jiraComponent=sonargraph-integration-plugin}

Sonargraph Integration Plugin

This plugin integrates Sonargraph version 8 and newer into your build. Sonargraph allows to define an architecture for a software system and automatically checks how the code base conforms to it.

For Sonargraph version 7 use Sonargraph Plugin.

Contents

Introduction

Sonargraph analyzes the static (i.e. compile-time) dependencies of your software. The free-of-charge license for the integration with Jenkins and also SonarQube allows to detect cyclic dependencies and additional metrics. You can mark the build as "unstable" or "failed" if cyclic dependencies are detected.
The real benefit of Sonargraph is that you can define a logical architecture and perform automatic checks how the code conforms to it. This functionality is only available for free, if you are working on a non-commercial Open-Source project. More information is available on our homepage, you can check there if you are eligible for a free license.

The Sonargraph Build component integrates Sonargraph in Ant, Gradle, Maven and Shell based builds. The online manual provides more details. This Jenkins plugin allows to define if the build should be marked as "unstable" or "failed" if architecture violations, cyclic dependencies, etc. are detected. Trends of metrics are displayed in charts and additionally the generated detailed HTML report is available for each build.

Getting Started

If you already have Sonargraph integrated in your build, and a Sonargraph report is already generated during one of your build steps, use the post-build step called "Sonargraph Integration Report Generation & Analysis", and select "Pre-generated". In this case no global Jenkins configuration for Sonargraph Build is needed.

If you are new to Sonargraph, we advice you to register on our Sonargraph Web Site, have a look at the whitepapers and screencasts to get an idea of Sonargraph's capabilities.
You need to have a license in order to analyse a project. To get started an evaluation license or the free integration license is sufficient.

If you are new to Sonargraph, use the post-build step called "Sonargraph Integration Report Generation & Analysis", and select "Generate with Sonargraph Build". In this case an installation of SonargraphBuild must be configured in global Jenkins configuration.

NOTE: This Jenkins plugin requires Sonargraph version 8 and newer. For Sonargraph version 7 use Sonargraph Plugin.

Global Configuration

Tool Installation for Sonargraph Build

NOTE: This global configuration is only required when you are going to use the "Generate with Sonargraph Build" option in "Sonargraph Integration Generation & Analysis" post-build action.

To see the global configuration options after installing the plugin, go to "Manage Jenkins" -> "Configure System" -> "Global Tool Configuration". You will find the "Sonargraph Build" section

Press button "Sonargraph Build Installations..." to see the list of already installed Sonargraph Build installations Jenkins knows about, if any. To add a new "Installation" of Sonargraph Build press button "Add Sonargraph Build", give it a descriptive name, use default Installer "Install from hello2morrow" for it, and select a Sonargraph Build version from the version drop down box.

NOTE: Version "newest" automatically updates your Sonargraph Build installation to the most recent version.

Sonargraph License Server

Sonargraph uses a web-based hello2morrow license server for activation code based licenses by default.
If you run your own local Sonargraph license server configure it here.

Job Configuration

Use the post-build action "Sonargraph Integration Report Generation & Analysis" to create Sonargraph's XML and HTML reports (or use a pre-generated XML report) and to configure how the Sonargraph analysis should affect the final result of the build.
For every Sonargraph metric supported by this plugin, you have the following options:

Take into account that if you have set to mark the build unstable for one metric, failed for any other and both metric's value are greater than zero, the worst state will prevail, so the build will be marked as failure in this case.
Besides controlling the build result, the plugin also generates graphics to monitor the trend of metrics across builds and it will display the full Sonargraph HTML report for each build.

NOTE: For the free Jenkins / SonarQube license, only the options for "cyclic elements" and "empty workspace" are available.

Add post-build action

Use Pre-Generated Report

Use this option to use a pre-generated Sonargraph report. To do so you must use Sonargraph Maven plugin, Sonargraph Gradle plugin, or Sonargraph Ant task in another upstream build step.
Enter the path to the Sonargraph XML report file that has been generated via the ANT task of Sonargraph. This path must be relative to the workspace.

Generate Report with Sonargraph Build

Use this option to let Sonargraph Build create a Sonargraph report.

Chart Configuration

Besides controlling the build result, the plugin also generates graphics to monitor the trend of metrics across builds and it will display the full Sonargraph HTML report for each build.

Either select the charts that you want to show by their language, or show all of them by selecting "All charts".

Mark Build

For every Sonargraph metric supported by this plugin, you have the following options:

Take into account that if you have set to mark the build unstable for one metric, failed for any other and both metric's value are greater than zero, the worst state will prevail, so the build will be marked as failure in this case.

NOTE: For the free Jenkins / SonarQube license, only the options for "cyclic elements" and "empty workspace" are available.

Configure Jenkins Logging

Sonargraph's Jenkins integration uses the standard Jenkins logger mechanism to provide feedback to the user about the events that occur during the execution of the post-build action or the generation of the graphics. To enable this feature follow these steps:

Now you should have the new log recorder configured like this:

When first created this log recorder is going to be empty and you will be able to see messages as the post-build actions are executed and graphics are generated.

Changelog

2.2.2 September 5th, 2019

2.2.0 December 19th, 2018

2.1.2 October 24th, 2017

2.1.1 October 2nd, 2017

2.1.0 July 7th, 2017

2.0.2 March 1st, 2017

2.0.1 February 15th, 2017

2.0.0 December 23rd, 2016

1.1.4 August 25th, 2016

1.0.5 July 28th, 2016

Compatibility Matrix

Plugin version 2.2.0: Compatible with SonargraphBuild >= 9.9.2 and Jenkins >= 2.138.2

Plugin version 2.1.1: Compatible with SonargraphBuild >= 9.4.6 and Jenkins >= 1.609.3

Plugin version 2.1.0: Compatible with SonargraphBuild >= 9.4.3 and Jenkins >= 1.609.3

Plugin version 2.0.0: Compatible with SonargraphBuild 9.1.1 - 9.4.2 and Jenkins >= 1.609.3

Plugin version 1.1.4: Compatible with SonargraphBuild 8.x - 9.1.0 and Jenkins >= 1.609.3