Agent Files
There are two agent files
Build Scanner - sl-build-scanner.jar
Test Listener - sl-test-listener.jar
Download them from: https://agents.sealights.co/sealights-java/sealights-java-latest.zip
Build Scanner
Creating a session ID
Standard Session ID
java -jar sl-build-scanner.jar -config {-token <arg> | -tokenfile <arg>} -appname <arg> -branchname <arg> -buildname <arg> -pi <arg> [-pe <arg>] [-buildsessionid <arg>] [-proxy <arg>] [-buildsessionidfile <arg>]
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
| Name of the application |
| The source branch of the application |
| The build label of the current build |
| Comma-separated list of packages to include in scan Supports wildcards (* = any string, ? = any character). For example: 'com.example.* ,io.*.demo, com.?ello.world' |
| Comma-separated list of packages to exclude from scan Supports wildcards (* = any string, ? = any character). For example: 'com.example.* ,io.*.demo, com.?ello.world' |
| Optional: A user provided session ID |
| Address of proxy to run connection through |
| Path to a file to save the build session id in. Default: |
Pull Request Session ID
java -jar sl-build-scanner.jar -prConfig {-token <arg> | -tokenfile <arg>} -appname <arg> -targetBranch <arg> -latestCommit <arg> -pullRequestNumber <arg> -repoUrl <arg> -pi <arg> [-pe <arg>] [-proxy <arg>] [-buildsessionidfile <arg>]
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
| Name of the application |
| The branch to which this PR will be merged into (already reported to SeaLights) |
| The full SHA of the last commit made to the Pull Request |
| The number assigned to the Pull Request from the source control |
| The pull request URL for the PR to be scanned, up until the section before the |
| Comma-separated list of packages to include in scan. Supports wildcards (* = any string, ? = any character). For example: |
| Comma-separated list of packages to exclude from scan. Supports wildcards (* = any string, ? = any character). For example: |
| Address of proxy to run connection through |
| Path to a file to save the build session id in. Default: |
Scanning a build
java -jar sl-build-scanner.jar -scan {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} [-workspacepath <arg>] [-r] [-baseSourceFolder <arg>] [-componentfile <arg>] [-enableNoneZeroErrorCode] [-fe <arg>] [-fi <arg>] [-moduleName <arg>] [-npf | -pfn <arg>] [-pathToMetaJson <arg>] [-proxy <arg>] [-scmProvider <arg>] [-scmBaseUrl <arg>] [-scmVersion <arg>] [-scm {git|none}] [-customFilterFile <arg>]
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| Path to the source workspace |
| Recursive search all folders under the workspace path |
| Relative path from user.dir to the workspace (specify the relative path from the .git folder up to com) Example: src/java |
| A path to a json file that is in the following format: |
| Exit with an error code if an error is encountered |
| Comma-separated list of files to exclude from scan Supports wildcards (* = any string, ? = any character). For example: '*-with-dependencies.jar , bad-bad?.war, *-source.jar' |
| Comma-separated list of files to include in scan Supports wildcards (* = any string, ? = any character). For example: '*-with-dependencies.jar , |
| Module name, the module name used in the pom.xml file Example: my-app |
| Do not generate Sealights property file |
| Path of Sealights property file to generate. Default is 'sealights.properties' |
| Optional: Path to a json file with metadata regarding the build |
| Address of proxy to run connection through |
| The provider name of your Source Control Management (SCM) tool. Values: Github, Bitbucket and Gitlab (Default is Github) |
| The URL to the repository which contains the code. If not provided, the url of the remote GIT origin will be used |
| The version of your Source Control Management (SCM) tool. If not provided, cloud version is assumed |
| Search for git information. Values: git, none (Default is git) |
| Path to JSON format method filter rules file, format described here |
Report build scan end
java -jar sl-build-scanner.jar -buildend {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} {-failed | -ok}
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| report the build scan was successful |
| report the build scan was failed |
| Address of proxy to run connection through |
Updating/Deleting a component from an integration build
java -jar sl-build-scanner.jar {-componentUpdate | -componentDelete} {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} {-componentids <arg> | -componentfile <file>}
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created for the integration build |
| Path to file containing the Session ID of configuration created for the integration build |
| One or several build session ID's (comma separated) of the component(s) to be updated or deleted |
| A path to a json file that is in the following format: |
| Address of proxy to run connection through |
Test Listener
Starting a test stage
java -jar sl-test-listener.jar start {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} -testStage <arg> [-labid <arg>] [-proxy <arg>]
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| Name of the test stage |
| Unique ID for a set of test labs in case multiple labs are running simultaneously |
| Address of proxy to run connection through |
Upload report files
Report files must be junit style xml reports
java -jar sl-test-listener.jar uploadReports {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} {-reportFile <arg>|-reportFilesFolder <arg>} -source <arg> -type <arg> [-labid <arg>] [-proxy <arg>]
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| Path to report file (multiple entries can be provided) |
| Path to folder containing report files (multiple entries can be provided). Note: all files in the folder will be uploaded |
| The reports provider. Example: |
| Values:
|
| Unique ID for a set of test labs in case multiple labs are running simultaneously |
| Address of proxy to run connection through |
Ending a test stage
java -jar sl-test-listener.jar end {-token <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} [-labid <arg>] [-proxy <arg>]
Parameter | Description |
---|---|
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| Unique ID for a set of test labs in case multiple labs are running simultaneously |
| Address of proxy to run connection through |
Installing test listener as Java Agent
The listener needs to be placed alongside the server and added to the JVM command line using the -javaagent
parameter together with its required parameters.
Usually, the easiest is to place it in the JAVA_OPTS="..."
, although it can also be placed in the JVM command itself.
java -javaagent:/path/to/sl-test-listener.jar {-Dsl.token=<arg> | -Dsl.tokenFile=<arg>} {-Dsl.buildSessionId=<arg> | -Dsl.buildSessionIdFile=<arg>} [-Dsl.tags=<arg>] [-Dsl.labId=<arg>] [-Dsl.proxy=<arg>] [-Dsl.testStage=<arg>] [-Dsl.filesStorage=<folder>] [-Dsl.webappLocation=<arg>] -jar yourapp.jar
Parameter | Description |
---|---|
| Path to Sealights Java test agent jar |
| Access token generated from the SeaLights server |
| Path to file containing the access token generated from the SeaLights server |
| Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| One or several tags (comma separated) to be passed to Sealights in order to label the test listener in the cockpit |
| Unique ID for a set of test labs in case multiple labs are running simultaneously |
| Address of proxy to run connection through |
| Name of the test stage (When running with JMeter) |
| Path to a folder that the agent can save temporary files to |
| Location of the webapps folder to search for the artifcat in, by defaule 'webapps' |
Logging
In order to enable logs, you can set the following parameters as environment variables or, when using as javaagent
, add them as -Dsl.*
parameters
Parameter | Description |
---|---|
| Sets the log level to one of the following: "off", "error", "warn", "info", "debug" |
| Set to true to enable log output to the console |
| Set to true to enable log output to a file |
| Provide a folder to save the log files in |
| Provide the name of the log file |
| Limit the number of log files to create. Default: 10 |
| Limit the size of the log file in megabytes (MB). Default value is 10 (i.e. 10*1024 KB) |
| Special JVM parameter to allow logging in Java 9 and later in addition to -Dsl.log.* above. |