Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

How to install and configure the Jenkins plugin

What the Kiuwan plugin for Jenkins does

The Kiuwan Plugin for Jenkins allows to execute Kiuwan analysis as a Post-build action.

If you need to execute Kiuwan a stage within a Jenkins Pipeline, please go to Jenkins Pipeline

 

Download the plugin

Download the Kiuwan Jenkins plugin from Github. It is open source under an MIT license. 

Install the plugin

  1. Enter your Jenkins dashboard

  2. Select Manage Jenkins and then Manage Plugins

  3. From the top tabs, select Available

  4. Find the Kiuwan Plugin using the search function of your browser or the search box provided by Jenkins 

  5. Check and install

 

 

How to configure the plugin

  1. Click Manage Jenkins and then Configure System
  2. Scroll down to the Kiuwan Global Settings section. 



  3. Configure your Kiuwan account credentials
  4. If the connectivity to the Internet is through a proxy, configure your proxy setting by clicking the Configure Proxy checkbox to provide the requested parameters
    1. Validate the connectivity by clicking Validate Credentials

How to run an analysis in the build process

The Kiuwan analysis is executed as a post-build action.

To run Kiuwan, add a Post action named "Analyze your source code with Kiuwan!" in your project configuration.

Three options are available:

  • Baseline Mode  
  • Delivery Mode
  • Expert Mode 

Baseline Mode

You can execute a baseline analysis, check its results, and change the status of your build if the selected measure does not meet the selected thresholds.

Selecting Baseline Mode configures Kiuwan Plugin for Jenkins to define the analysis scope as baseline.

 

 

Kiuwan Application Name = configured to the application name defined in Kiuwan. 

  • If the app does not exist, it will be created. 
  • If not set, the Jenkins project name will be used.

Analysis Label = set a lable to identify the analysis.

  • If not set, Jenkins build number (#n) will be used.

Click Advanced to define additional configuration parameters.

  • Encoding type. 
  • Include and Exclude patterns for the analysis. 
  • Timeout = indicates the maximum allowed time (in minutes) for Jenkins to wait for Kiuwan analysis. If that time is reached, the build will be set to ABORTED.  

 

Icon

This timeout will alse be passed to Kiuwan Local Analyzer as a timeout for its internal tasks (rules, metrics and clones), overriding the timeout value set in AGENT_HOME/conf/analyzer.properties.

Set the Jenkins timeout value high enough to allow Kiuwan to finalize the analysis.

 

 

These configuration values will override parameter values set in JENKINS_HOME/tools/KiuwanLocalAnalyzer/conf/analyzer.properties.

For any other configuration parameter not shown in this configuration page, you should edit analyzer.properties file.

 

In Baseline mode, you can set the build status depending on thresholds based on indicators of the Kiuwan analysis:

  • Quality indicator
  • Risk Index
  • Effort to Target

You can define thresholds to mark the build as UNSTABLE and FAILURE depending on indicator values as the above picture shows.

Delivery Mode

 You can execute a delivery analysis if you have a subscription with deliveries, .

Selection of Delivery Mode configures Kiuwan Plugin for Jenkins to define the analysis scope as “Delivery” (partial or complete).

 

As in Baseline mode, you need to define Kiuwan Application Name and Analysis Label.

Also, clicking on Advanced button will allow you to set additional parameters:

 

 

Special importance has Analysis Scope parameter:

  • Complete Delivery
  • Partial Delivery

Please, see note on Baseline mode about “timeout” specification.

Wait For Audit Results checkbox allows to mark the build depending on the result of the Audit associated to the Kiuwan application. If checked, the build will be marked as UNSTABLE in case the Audit fails.

 

Icon

You can configure any parameter by referencing system variables with the syntax ${MY_VAR}

 

 

Expert  Mode

You can indicate Kiuwan Local Analyzer's command line options and extra parameters manually.

Selection of Expert Mode allows full control on Kiuwan analysis configuration.

 

Expert Mode allows to set/override any parameter value configured in JENKINS_HOME/tools/KiuwanLocalAnalyzer/conf/analyzer.properties

By clicking on Advanced button, you can bind the result codes of Kiuwan Local Analyzer with Jenkins' build results.

 

You can find further reference on return codes in Local Analyzer Return Codes

 

 

Jenkins Pipeline

 

In order to execute Kiuwan as a stage in Jenkins Pipeline you need to install Kiuwan Local Analyzer (KLA) into the Jenkins node.

 

It's highly recommended to install KLA with the same user that will execute KLA when launched from Jenkins Pipeline.

In case installation and execution users be different, make sure that execution user has read-write-execute permissions over KLA installation directory and subdirectories.

 

Once KLA is installed at the Jenkins node, in order to execute Kiuwan as a stage in Jenkins Pipeline you can use next Groovy script as a basis:

 

 

View the results

Once you have installed and configured the Kiuwan plugin in your Jenkins installation, you will be able to run a Kiuwan analysis after the build process.

After execution, and based on analysis results, you will be able to mark the build (SUCCESS, UNSTABLE, FAILURE, etc) according to the Kiuwan analysis results.

Also, after the build process, the Kiuwan Plugin for Jenkins adds a link to the analysis results (visible in your Kiuwan account) on the execution build page.

 

 

 

  • No labels