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 Black Duck Security Scan Pipe, but requires an additional step to download the Bridge CLI.
To use the CLI directly from a pipeline, the correct Bridge CLI Black Duck parameters must be passed directly inside the workflow. Furthermore, appropriate access credentials are required to download and use it. Consult the overview page for further details and instructions on use.
To discover more about the Black Duck 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:
- Admin access to a Bitbucket repository.
- Access to a Black Duck SCA server configured with:
- A Black Duck SCA role that allows creation of authentication tokens.
- A Black Duck SCA API token with Read and Write access. This can be created by navigating to from within Black Duck SCA.
- A Bitbucket Access Token is required to allow the pipeline to inject Pull Request review comments and raise Fix Pull Requests
- For security reasons, it is advisable to use Bitbucket variables with the
securedoption checked to store credentials and access tokens. -
Add the following variables and secured variables at the repository level (Repository Settings > Pipelines > Secrets and Variables or Workspace Settings > Workspace Variables > Add Variables)
Name Type Description Example BRIDGE_BLACKDUCKSCA_URLVariable Black Duck SCA Server URL https://blackduck.example.comBRIDGE_BLACKDUCKSCA_TOKENSecured Variable Black Duck SCA API Token REPLACE_WITH_YOUR_TOKENBRIDGE_BITBUCKET_API_TOKENSecured Variable A Bitbucket Access Token required to inject Pull Request Comments and raise Fix Pull Requests REPLACE_WITH_YOUR_TOKENBRIDGECLI_LINUX64Variable Bridge CLI Download URL https://repo.blackduck.com/bds-integrations-release/com/blackduck/integration/bridge/binaries/bridge-cli-bundle/latest/bridge-cli-bundle-linux64.zip - The following Bridge CLI parameters are required to inject Pull Request comments and raise fix Pull Requests:
Parameter Description Value Scan type blackducksca.fixpr.enabledRaise Fix PRs for detected issues trueFull blackducksca.automation.prcommentEnable PR comments truePR bitbucket.project.repository.pull.numberID of PR with source code to scan $BITBUCKET_PR_ID