Required Pull Request Parameters (SCM/CI)
When reporting a Pull Request to SeaLights, the parameters required to configure the pull request BSID vary between the source control provider. This article will help you to map the required parameters to their location within the few most common source control or CI providers.
Here is a table summarizing the most common variables in use in the relevant SCM section
pullRequestNumber
ghprbPullId
BITBUCKET_PR_ID
CI_EXTERNAL_PULL_REQUEST_IID
GIT_PULL_REQUEST
latestCommit
ghprbActualCommit
BITBUCKET_COMMIT
CI_COMMIT_SHA
GIT_COMMIT
repoUrl
ghprbPullLink
BITBUCKET_REPO_SLUG
or BITBUCKET_GIT_HTTP_ORIGIN
CI_REPOSITORY_URL
GIT_REPO_URL
targetBranch
ghprbTargetBranch
BITBUCKET_PR_DESTINATION_BRANCH
CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME
CHANGE_TARGET
For latestCommit parameter, we’re highlighting the short version in the screenshots below but the long/entire SHA identifier needs to be used.
GitHub

If you’re using the GitHub Actions or the GitHub Pull Request Builder plugin for Jenkins, you can use the following mapping to variables suggested below
pullRequestNumber
github.event.pull_request.number
ghprbPullId
latestCommit
github.event.pull_request.head.sha
ghprbActualCommit
repoUrl
$GITHUB_SERVER_URL/$GITHUB_REPOSITORY
ghprbPullLink
Something similar to: https://github.mycompany.com/myappjava/ if the pull request URL is https://github.mycompany.com/myappjava/pull/8031 in other words everything before word ‘pull’ like shown in the picture above
targetBranch
github.event.pull_request.base.ref
ghprbTargetBranch
This is the branch name itself and might need to have a prefix added (Like: "origin/") to match the branch that was provided to SeaLights when scanning the merged branch
GitLab

Then, switching to the “Commits” tab:

Using the GitLab plugin for Jenkins
If you’re using the GitLab plugin for Jenkins you can use the following mapping to environment variables provided by the plugin
pullRequestNumber
gitlabMergeRequestIid
latestCommit
gitlabMergeRequestLastCommit
repoUrl
gitlabSourceRepoHomepage
targetBranch
gitlabTargetBranch
This is the branch name itself and might need to have a prefix added (Like: "origin/") to match the branch that was provided to SeaLights when scanning the target branch
BitBucket

Bitbucket provides a set of default variables that are available for builds, and can be used in scripts. These variables are detailed in the official Bitbucket documentation and can be used like below
pullRequestNumber
BITBUCKET_PR_ID
latestCommit
BITBUCKET_COMMIT
repoUrl
BITBUCKET_REPO_SLUG
In some configurations, you may need to prepend the base URL of your repository, like "https://bitbucket.mycompany.int/$BITBUCKET_REPO_SLUG"
targetBranch
BITBUCKET_PR_DESTINATION_BRANCH
This is the branch name itself and might need to have a prefix added (Like: "origin/") to match the branch that was provided to SeaLights when scanning the merged branch
Using Webhook to Jenkins for Bitbucket plugin (sending URL parameters to Jenkins)
Pull Request-related variables (e.g. Pull Request number) can be passed from Bitbucket to a Jenkins job via the Webhook to Jenkins for Bitbucket plugin using URL parameters to be defined in the plugin settings.
In the example below, the Bitbucket Pull Request ID number (parameter PR_ID
) is being passed via the PR_NUM
variable name and this variable will then be available as a parameter within the Jenkins job. Each URL parameter to be passed should be placed on a separate line in the URL parameters box.

Bamboo
pullRequestNumber
Please refer to the workaround(s) shared in the comments of this Bamboo support page: https://jira.atlassian.com/browse/BAM-18350
latestCommit
bamboo.repository.pr.key
repoUrl
bamboo.planRepository.<position>.repositoryUrl
targetBranch
bamboo.repository.pr.targetBranch
The base reference name of the webhook event that triggered the build. It is the branch reference for pull requests (i.e. target branch). It may require some string manipulation to match the branch name that was provided to SeaLights when scanning the reference branch.
Azure DevOps (formerly Team Foundation Server)
Sealights provides support only for ADO or TFS “Git-Based“ repositories: TfsGit
, Git,
or GitHub
. Pull Request integration won’t work with TfsVersionControl
or Svn
repository types.

pullRequestNumber
System.PullRequest.PullRequestNumber
latestCommit
The default environment ADO variable Build.SourceVersion
cannot be used. It is not providing the latest commit from the PR branch - as expected by Sealights - but only the local commit resulting from the merge operation.
A common solution is to retrieve the “-1” commit identifier in form the git log
command.
repoUrl
System.PullRequest.SourceRepositoryURI
targetBranch
System.PullRequest.TargetBranch
This is the branch name itself and might need some string manipulation to remove a prefix added (Like: "refs/heads/") to match the branch that was provided to SeaLights when scanning the merged branch.
AWS CodeBuild
pullRequestNumber
CODEBUILD_WEBHOOK_TRIGGER
For builds triggered by a pull request, its format is pr/pull-request-number
: a string manipulation is required to remove the /pr
prefix and retrieve the number itself.
latestCommit
CODEBUILD_RESOLVED_SOURCE_VERSION
repoUrl
CODEBUILD_SOURCE_REPO_URL
targetBranch
CODEBUILD_WEBHOOK_BASE_REF
The base reference name of the webhook event that triggered the build. It is the branch reference for pull requests (i.e. target branch). It may require some string manipulation to match the branch name that was provided to SeaLights when scanning the reference branch.
Related articles
Gradle: Scanning Builds
Last updated
Was this helpful?