...
token or tokenFile - set with a token or a file containing the token obtained from the SeaLights dashboard
Managing the session ID
If you create a Build Session ID externally, provide the following fields:
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
If you want to create a Build Session ID using the SeaLights Gradle plugin, provide the following fields:
createBuildSessionId - Set to true
appName - Name of the application as you want to see it on the SeaLights dashboard
branchName - Name of the branch as you want to see it on the SeaLights dashboard
buildName - Name of the build as you want to see it on the SeaLights dashboard
packagesIncluded - Comma-separated list of packages to include in the scan operation. Note: This is defining a subset, so it must include the star to include all sub-packages/classes
If you want to create a Pull Request Build Session ID using the SeaLights Maven plugin, provide the following fields:
createPRBuildSessionId - Set to true
appName - Name of the application as you want to see it on the SeaLights dashboard
targetBranch - The branch to which this PR will be merged (already reported to SeaLights)
pullRequestNumber - The number assigned to the Pull Request from the source control
latestCommit - The full SHA of the last commit made to the Pull Request
repositoryUrl - The pull request URL for the PR to be scanned up until the section before the
pullRequestNumber
valuepackagesIncluded - Comma-separated list of packages to include in the scan. Note: This is defining a subset, so it must include the asterisk to include all sub-packages/classes
packagesExcluded - (Optional) Comma-separated list of packages to include in the scan. Note: This is defining a subset, so it must include the asterisk to include all sub-packages/classes
executionType - Provide which executions need to be handled by the Gradle plugin
full - Execute both the build scanner and the test listener
scanonly - Execute only the build scanner
testTasksAndStages - (Optional) Mapping of test tasks’ names to test stage names as they will be displayed on the SeaLights dashboard. It should be of the format {"testTask1":"testStage1", "testTask2":"testStage2"}
proxy - (Optional) Address of proxy to run connection through
...
This command will (1) restore gradle.build
from its backup, (2) delete the backup file, and (3) delete the sealights.gradle
file.
Failure at any of these steps won’t prevent the next ones so that the project is restored as much as possible.
Configuring
...
SCM to enable links from the dashboard
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 sealightsJvmParams
section:
...
Code Block |
---|
"gradleProjectConfig": {"repoConfig": "maven{\nurl \"https://artifactory.company.com/artifactory/remote-repos\"\ncredentials {\nusername = \"USERNAME\"\npassword = \"PASSWORD\"\n}\n}"} |
...
Samples
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Shell script
Info |
---|
This script is very often added to a new pre-build step in your CI configuration (i.e. Jenkins). |
Code Block | ||
---|---|---|
| ||
echo "Downloading Sealights Agents..." wget -nv https://agents.sealights.co/sealights-java/sealights-java-latest.zip unzip -o sealights-java-latest.zip echo "Sealights agent version used is:" `cat sealights-java-version.txt` echo '{ "executionType": "scanonly", "tokenFile": "sltoken.txt", "createBuildSessionId": true, "appName": "${System.getenv(\"JOB_NAME\")}", "branchName": "${System.getenv(\"GIT_BRANCH\")}", "buildName": "SL_Timestamp", "packagesIncluded": "*com.example.*", "packagesExcluded": "", "filesIncluded": "*.class", "filesExcluded": "*test-classes*", "recursive": true, "includeResources": true, "proxy": null, "logEnabled": false, "logDestination": "console", "logLevel": "off", "logFolder": "/tmp/sl-logs", "scannerJar": "./sl-build-scanner.jar", "listenerJar": "./sl-test-listener.jar", "sealightsJvmParams": { "sl.scm.provider": "bitbucket" } }' > sl-gradle-configbuild.json echo "Updating Build.gradle with Sealights..." java -jar sl-build-scanner.jar -gradle -configfile sl-gradle-configbuild.json -workspacepath . |
Next step is to run your regular Gradle build command, e.g. gradle clean build.
Gitlab YML
Info |
---|
In the example below:
|
Code Block | ||
---|---|---|
| ||
build:
stage: build
before_script:
- echo "Downloading Sealights Agents..."
- wget -nv https://agents.sealights.co/sealights-java/sealights-java-latest.zip
- unzip -o sealights-java-latest.zip
- echo "Sealights agent version used is:" `cat sealights-java-version.txt`
- >
echo '{
"executionType":"scanonly",
"token":"'$SEALIGHTS_AGENT_TOKEN'",
"createBuildSessionId":true,
"appName":"'$CI_PROJECT_NAME'",
"branchName":"'$CI_COMMIT_BRANCH'",
"buildName":"'$CI_PIPELINE_ID - $CI_JOB_STARTED_AT'",
"packagesIncluded":"*com.mycompany.*",
"sealightsJvmParams": {
"sl.scm.provider": "gitlab",
"sl.scm.baseUrl": "'${CI_SERVER_URL}/${CI_PROJECT_PATH}'/blob" }
}' > sl-plugin-settings.json
- cat sl-plugin-settings.json
- echo "Updating Gradle with Sealights..."
- java -jar sl-build-scanner.jar -gradle -configfile sl-plugin-settings.json -workspacepath . |
The rest of your pipeline is unchanged.
Page Properties | ||
---|---|---|
| ||
|