SeaLights Jenkins plugin - Scanning Builds and running Unit Tests using Maven

Plugin Configuration

In order to Scan builds and run Unit Tests using Maven using the SeaLights Jenkins plugin, Jenkins must be used together with the Maven build tool.

Prerequisites

The SeaLights Jenkins Plugin and the SeaLights Test Listener must have read/write permissions to the temp folder of the machine, unless you are using a different file storage folder, which can be configured on the SeaLights global configuration screen.

Since the SeaLights Jenkins plugin modifies the pom.xml file, then if the SeaLights Maven plugin is already in your pom.xml file, the SeaLights Jenkin plugin will not have an effect.

Installation

First install and set up the Jenkins plugin, See 'SeaLights Jenkins plugin - Installation and setup' for details

Configuring your Job

Freestyle Project

  • Open your Freestyle Project job

Relpace your Invoke top-level Maven targets build step with the Invoke top-level Maven targets with SeaLights Continuous Testing build step:

  1. In the Build section, click Add build step, and select Invoke top-level Maven targets with SeaLights Continuous Testing
  2. Enter the Maven goals used to build your project in the Goals field
  3. If your current Invoke top-level Maven targets step has anything in the advanced configuration then apply the same settings to the SeaLights step as well in the Advanced section
  4. Remove the previous build Invoke top-level Maven targets step that you used to run Maven


For descriptions of each of the available options, see Jenkins Plugin Parameters

Configuring SeaLights options

Regardless of the type of project you have, once you have configured the above, you now need to configure the SeaLights options

  • Press the SeaLights... button to expose the SeaLights parameters

Session ID

  • Validate that ${SL_BUILD_SESSION_ID} is in the Build Session Id field

Configuring the SCM

SeaLights by default provides all links to the SCM for Github.

You can configure SeaLights to prepare the links for Bitbucket and Gitlab as well with the following parameters placed under the Sealights->Sealights Advanced->Additional Arguments sealightsJvmParams section:

  • sl.scm.provider - set to github, bitbucket or gitlab

  • sl.scm.baseUrl - When working with an on-premise installation of your SCM and access from the build machine is different than the one accessed by the users, then you can provide the base URL to use

  • sl.scm.version - set to the version of the on-premise version you use

sealightsJvmParams=sl.scm.provider:bitbucket$$sl.scm.baseUrl:https://{dns}/projects/{project}/repos/{repo}/browse$$sl.scm.version:4.9.0



There are various other setting that can be changed and set according to your needs. For descriptions of each of the available options, see Jenkins Plugin Parameters