As an alternative to the Black Duck Security Scan Plugin, Bridge CLI can be downloaded and directly executed in a Jenkins pipeline. It has all the functionality of the plugin, but requires an additional step to download the Bridge CLI.
To use the CLI directly from a pipeline, the correct Bridge CLI Polaris parameters must be passed directly inside the workflow. Furthermore, appropriate access credentials are required to download and use it. Consult Using Bridge CLI with Polaris for further details and instructions on use.
Prerequisites
-
The following reading is recommended before starting this quickstart:
- Administrative access to a GitHub repository.
- A Personal Access Token (PAT) is required to allow the pipeline to inject Pull Request review comments and raise Fix Pull Requests. The PAT should be generated for the SCM platform that Bridge CLI integrates with Polaris from within the Jenkins pipeline, e.g. GitHub, GitLab, Azure, Bitbucket etc.
- The Branch Source plugin must be installed for the appropriate platform to enable Jenkins to integrate with a source code repository and validate Pull Request events.
- For security reasons, it is advisable to use Jenkins Credentials to store sensitive information.
- Add the following credentials in Jenkins ()
Credential ID Type Description Example polaris-credentialsUsername with password Polaris username and password REPLACE_WITH_YOUR_TOKENscm-patSecret text SCM Platform Personal Access Token (e.g., GitHub, GitLab) REPLACE_WITH_YOUR_TOKEN -
Ensure the following environment variables are set correctly in the pipeline:
Variable Description Example BRIDGECLI_LINUX64Bridge CLI Download URL https://repo.blackduck.com/artifactory/bds-integrations-release/com/blackduck/integration/bridge/binaries/bridge-cli-bundle/latest/bridge-cli-bundle-linux64.zip BRIDGE_POLARIS_SERVERURLPolaris server URL. https://polaris.blackduck.comBRIDGE_POLARIS_ACCESSTOKENPolaris access token retrieved from Jenkins credentials. credentials('polaris-credentials')BRIDGE_POLARIS_APPLICATION_NAMEPolaris application name. Defaults to the repository name if not specified. jenkins-quickstart-${env.REPO_NAME}BRIDGE_POLARIS_PROJECT_NAMEPolaris project name. Defaults to the repository name if not specified. ${env.REPO_NAME}BRIDGE_POLARIS_BRANCH_NAMEPolaris branch name to scan. Defaults to the current branch name. $BRANCH_NAMEBRIDGE_POLARIS_ASSESSMENT_TYPESComma-separated list of assessment types to run. Supported values: SAST,SCA,DAST.SAST,SCASCM_PATSCM Platform Personal Access Token from Jenkins credentials. Required to inject Pull Request comments. credentials('scm-pat') - The following Bridge CLI parameters are required to inject Pull Request comments:
Parameter Description Value polaris.prcomment.enabledEnable Pull Request comments truegithub.repository.pull.numberID of Pull Request to scan $CHANGE_IDNote: Parametergithub.repository.pull.numberis specific to adding Pull Request Comments for GitHub. Refer to the SCM Pull Request comments table for the equivalent Bridge CLI parameter required for integrating with other SCM platforms. - The
polaris.fixPR.enabledparameter should be set totrueto enable Bridge to raise Fix Pull Requests from scan findings on non Pull Request branches.
Coverity requires additional configuration for compiled languages. For languages that use a build system (such as C++, Java, etc.), Coverity must be configured with build and clean commands to capture and analyze the build.
- The instructions below use the Bridge
COVERITY_BUILD_COMMANDandCOVERITY_CLEAN_COMMANDenvironment variables to specify the build and clean commands. - See Using Bridge With Compiled Languages and the Coverity section in Bridge Options to Configure Tools for an overview of the various methods available for configuring Bridge CLI to integrate with Coverity to capture and analyze the build for compiled languages.
Instructions
Troubleshooting and support
Automatic application creation will fail for users with a parallel subscription. To create the application manually before running the pipeline, consult create an application in Polaris.