Table of Contents | ||
---|---|---|
|
Add -Psealights maven targets in the jenkins build step
Configuring Maven plugin in the pom.xml file
Note |
---|
You can create the configuration in a profile or directly in the main settings |
...
- groupId - set to io.sealights.on-premise.agents.plugin
- artifactId - set to sealights-maven-plugin
- version - set to 4.0.991
- configuration section with the following parameters
- token or tokenFile - set with a token or a file containing the token obtained from the SeaLights dashboard
- buildSessionId or buildSessionIdFile - Set with a build session id or a file containing the build session id created by the config step
- createBuildSessionId - Set to false
- testStage - Set the name of the test stage as will be displayed on the SeaLights dashboard
- workspacepath - Set to with the path to the binary files to scan (Different per module). For example ${project.build.outputDirectory}
Note: there are rare cases that this needs to be changed. Make sure you really need to change it before doing so. - filesincluded - Set to the binary files to scan. for example *.class
- filesexcluded - Set to the binary files to excluded from the scan. for example *test-classes*
- filesStorage - Set to the temp folder for the agent to create temporary files in. For example /tmp
- logEnabled - Set to true if you want a log to be created
- logLevel - Set the log level to create. For example INFO
- metadata section with CI details
- jobName - Set to the name of the build job. For example ${JOB_NAME}
- logsUrl - Set to the link that the SeaLights dashboard should provide to view the build log. For example ${BUILD_URL}/console
- sealightsJvmParams - Entry to provide JVM params to the SeaLights agent
- includeResources - Set to include the token and build session ID files in the built resources
- executions section following executions
- If you want to scan a build add an execution with the goal set to build-scanner
- If you want to monitor the test information add an execution with the goal set to test-listener
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<profiles> <profile> <id>sealights</id> <build> <plugins> <plugin> <groupId>io.sealights.on-premise.agents.plugin</groupId> <artifactId>sealights-maven-plugin</artifactId> <version>4.0.991</version> <configuration> <!-- <token>${SL_TOKEN}</token> --> <tokenFile>/path/to/sltoken.txt</tokenFile> <!-- <buildSessionId>${SL_BUILD_SESSION_ID}</buildSessionId> --> <buildSessionIdFile>buildSessionId.txt</buildSessionIdFile> <createBuildSessionId>false</createBuildSessionId> <testStage>Unit Tests</testStage> <filesincluded>*.class</filesincluded> <filesStorage>/tmp</filesStorage> <filesexcluded>*test-classes*</filesexcluded> <logEnabled>false</logEnabled> <logLevel>WARN</logLevel> <sealightsJvmParams></sealightsJvmParams> <includeResources>true</includeResources> <metadata> <jobName>${JOB_NAME}</jobName> <logsUrl>${BUILD_URL}/console</logsUrl> </metadata> <!-- <proxy>http://your.proxy:1234/proxy> --> </configuration> <executions> <execution> <id>a1</id> <goals> <goal>build-scanner</goal> </goals> </execution> <execution> <id>a2</id> <goals> <goal>test-listener</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> |
Creating a buildSessionId
Instead of creating the build session ID externally, you can create it directly in the pom
...
- appName - Name of the application as you want to see it on the SeaLights dashboard
- branch - Name of the branch as you want to see it on the SeaLights dashboard
- build - Name of the build as you want to see it on the SeaLights dashboard
- packagesincluded - Comma-separated list of packages to include in scan
Code Block | ||
---|---|---|
| ||
<configuration> <createBuildSessionId>true</createBuildSessionId> <appName>${JOB_NAME}</appName> <branch>${GIT_BRANCH}</branch> <build>${BUILD_NUMBER}</build> <packagesincluded>*com.example.*</packagesincluded> <!-- <packagesexcluded></packagesexcluded> --> </configuration> |
Configuring SCM
SeaLights by default provides all links to the SCM for Github.
...
Code Block | ||||
---|---|---|---|---|
| ||||
<sealightsJvmParams> <sl.scm.provider>bitbucket</sl.scm.provider> <sl.scm.baseUrl>https://my.bitbucket.com/projects/ABCD/repos/XYZ/browse/A1</sl.scm.baseUrl> <sl.scm.version>4.6</sl.scm.version> </sealightsJvmParams> |
Pre-downloading the agents
The Maven plugin downloads the recommended agent at the beginning of the run. If you want to pre-download them and provide them to the plugin, you can do so with the flags buildScannerJar & testListenerJar.
...
Note |
---|
The agents used here should be downloaded either with the latest agent or the recommended one as stated in Downloading the java agent files |
Tagging
You can add tags to be viewed in the cockpit for the agents started by this maven job by passing them through the sl.tags property in the sealightsJvmParams field
...