/
Configuring your Pull Request flow to report to SeaLights

Configuring your Pull Request flow to report to SeaLights

This article explains the required steps to report your Pull request to SeaLights, compare it to the merge branch and view the results within your source control.

Note that since the results of Pull Request builds are intended to be shown as an overlay within source control using the Chrome extension, they are not displayed on the Sealights dashboard

The following steps are required to report a Pull Request to SeaLights:

Create a Build Session ID for the Pull Request

You create the Pull Request build session ID by using the SeaLights agent with the prConfig option command that requires the following parameters:

Parameter Name

Description

Parameter Name

Description

appname

The same appName reported to SeaLights for this application

targetBranch

The branch to which this PR will be merged into (already reported to SeaLights)

latestCommit

The full SHA of the last commit made to the Pull Request

pullRequestNumber

The number assigned to the Pull Request from the source control

repoUrl

The pull request URL for the PR to be scanned, up until the section before the pullRequestNumber value.

The Target branch must have builds already reported to Sealights, otherwise the prConfig command will fail.
If your development process includes pull requests merged to features branch, you may want to exclude them from the scope if Sealights analysis or enforce a build to be reported with the creation of the feature branch (via a webhook).

Sample commands

Below are examples of usage of the prConfig CLI command with the Sealights agents.

Java

java -jar sl-build-scanner.jar -prConfig -tokenfile sltoken.txt -appname "MyAppJava" -targetBranch "master" -latestCommit "$MYGH_PR_COMMIT" -pullRequestNumber "807" -repoUrl "https://www.github.com/myappjava/" -pi "*com.example.*"

slnodejs

./node_modules/.bin/slnodejs prConfig --tokenfile sltoken.txt --appname "MyAppjs" --pullRequestNumber "448" --targetBranch "develop" --latestCommit $MYGH_PR_COMMIT --repositoryUrl "https://www.github.com/myappjs/" --proxy "http://proxy2.int"

.Net/Core

SL.DotNet.exe prConfig --appName "myApp.Net" --pullRequestNumber "770" --targetBranch "develop" --latestCommit $MYGH_PR_COMMIT --repositoryUrl "https://www.github.com/myappdotnet/" --includeNamespace myNameSpace.* --buildSessionIdFile buildSessionId.txt

Python

Golang (slcli)

The parameters packages included for Java and namespace for DotNet should be exactly the same as what was defined to SeaLights for the merged branch so that the compared results will be the same.

Perform a scan and run tests against the PR code

The same SeaLights flow is then configured within the PR context:

  • Using the build session ID created in the previous stage, a complete cycle is run on the PR code:

    • Build scan which includes all modules, including the code changes

    • Test executions assigned to the build are run against the code as part of the PR pipeline

See the following documentation for an example on how to configure this for Maven, using a JSON file.

Review the results within the PR view in your source control

In order to view the results in line

After performing the pull request, you will be able to view the results inline with your source control within the PR view, denoted with a red diamond: