As an alternative to the Black Duck Security Scan Pipe, the Bridge CLI can be downloaded and directly executed in a Bitbucket pipeline. It has all the functionality of the plugin, but requires an additional step to download the Bridge CLI.
To use Bridge CLI directly from a Bitbucket pipeline, the correct Bridge CLI Software Risk Manager parameters must be passed directly inside the workflow. Appropriate access credentials are required to download and use it. Consult the overview page for further details and instructions on use.
Note: The Black Duck Security Scan Pipe (recommended) can be used for pipelines instead of Bridge CLI by following the quickstart guide. The plugin has equivalent functionality and handles the Bridge CLI download and execution automatically.
To discover more about the Bitbucket Security Scan Pipe and what it can do, take a look at the overview page.
Prerequisites
- The following reading is recommended before starting this quickstart:
- For security reasons, it is advisable to use Bitbucket variables and secrets to store credentials and access tokens.
- Add the following variables and secrets in your Bitbucket repository or workspace settings:
Variable Type Description Example SRM_URLRepository Variable SRM server URL https://srm.example.comSRM_APIKEYRepository Secret SRM API key REPLACE_WITH_YOUR_APIKEYBRIDGECLI_LINUX64Repository Variable Bridge CLI download URL for Linux https://repo.blackduck.com/artifactory/bds-integrations-release/com/blackduck/integration/bridge/binaries/bridge-cli-bundle/latest/bridge-cli-bundle-linux64.zip - Software Risk Manager uses Coverity to perform SAST assessments. 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.If using a compiled language, add the following additional variables to specify the build and clean commands appropriate for the target language:See Using bridge with compiled languages and the Coverity section in Bridge Options to Configure Tools for an overview of the various alternative methods available for configuring Bridge CLI to integrate with Coverity to capture and analyze the build for compiled languages.
Parameter Type Description Value BRIDGE_COVERITY_BUILD_COMMANDVariable Build command for compiled languages mvn -B -DskipTests packageBRIDGE_COVERITY_CLEAN_COMMANDVariable Clean command for compiled languages mvn -B clean
Instructions
Follow the steps below to configure a Bitbucket pipeline that invokes Bridge CLI for SRM scans:
Troubleshooting and support
If errors are encountered during the pipeline run, ensure that all variables are set correctly and that the Bridge CLI can access the SRM server.
If a pipeline error is encountered similar to the example below, then it is likely that the BRIDGE_SRM_BRANCH_PARENT parameter has not been set.
Important: ERROR: Branch "develop" does not exist for the project and "srm.branch.parent" is empty but is required along with "srm.branch.name" for creating the branch.
When scanning new non-default branches, e.g. develop, stage or release, the BRIDGE_SRM_BRANCH_PARENT parameter must be set to the name of the default branch, e.g. main. An example is shown in the Quickstart code example in the Instructions section.