As an alternative to the Black Duck Security Scan Template, the Bridge CLI can be downloaded and directly executed in a GitLab CI/CD pipeline. It has all the functionality of the template, but requires an additional step to download the Bridge CLI.
To use the CLI directly from a pipeline, the correct Bridge CLI Black Duck® SCA 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.
Note: The Black Duck Security Scan Template (recommended) can be used for pipelines instead of Bridge CLI by following the quickstart guide. The template has equivalent functionality and handles the Bridge CLI download and execution automatically.
To discover more about the Black Duck Security Scan Template 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 GitLab 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 GitLab Personal Access Token is required to allow the pipeline to inject Merge Request review comments.
- For security reasons, it is advisable to use GitLab CI/CD Variables to store credentials and access tokens. It is recommended that the variables are added as project variables. Group variable inheritance can cause scans to fail under certain conditions.
- Add the following variables and secrets at the project level ()
Variable Type Description Example BLACKDUCK_URLVariable Black Duck SCA Server URL https://blackduck.example.comBLACKDUCK_API_TOKENMasked Variable Black Duck SCA API Token REPLACE_WITH_YOUR_TOKENGITLAB_USER_TOKENMasked Variable GitLab Personal Access Token REPLACE_WITH_YOUR_TOKENBRIDGECLI_LINUX64Variable Bridge CLI 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 Merge Request comments and raise fix Merge Requests:
Parameter Description Value Scan type BRIDGE_BLACKDUCKSCA_FIXPR_ENABLEDRaise Fix MRs for detected vulnerabilities trueFull BRIDGE_BLACKDUCKSCA_AUTOMATION_PRCOMMENTEnable MR comments trueMR BRIDGE_GITLAB_REPOSITORY_PULL_NUMBERID of MR with source code to scan $CI_MERGE_REQUEST_IID