Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
printablefalse

...

Note
  • Do not call the JSON file 'sealights.json' as the agent uses this file name for override options

  • For troubleshooting purpose,  you can use "buildName":"SL_Timestamp" in your JSON file to have the Sealights Gplugin generating automatically a time stamp (yyyy.MM.dd-hh.mm format) as a default buildname

...

The Gradle 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 scannerJarlistenerJar.

...

The agents referred here

...

can be

...

either

...

the latest agent or the recommended one set in your account settings as stated in Downloading the java agent files. They should be downloaded and made available prior to the Gradle execution.

Code Block
"scannerJar": "./sl-build-scanner.jar"
"listenerJar": "./sl-test-listener.jar"

Sample shell script 

Info

This script is very often added to a new pre-build step in your CI configuration (i.e. Jenkins).

Code Block
languagebash
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  '{ 
    "tokenFile": "sltoken.txt", 
    "createBuildSessionId": true,
    "appName": "${System.getenv(\"JOB_NAME\")}",   
    "branchName": "${System.getenv(\"GIT_BRANCH\")}",
    "buildName": "${System.getenv(\"BUILD_NUMBER\")}",
    "packagesIncluded": "*com.example.*",   
    "packagesExcluded": "",
    "filesIncluded": "*.class",
    "filesExcluded": "*test-classes*",
    "recursive": true,
    "includeResources": true,
    "testTasksAndStages": {"test": "Unit Tests"},
    "labId": null,
    "executionType": "full",
    "logEnabled": false,
    "logDestination": "console",
    "logLevel": "off",
    "logFolder": "/tmp"
  }' > sl-config.json
 
echo "Updating Build.gradle with Sealights..."
java -jar sl-build-scanner.jar -gradle -configfile sl-config.json -workspacepath .

...