This quickstart explains how to set up the Black Duck Security Scan Template to run a pipeline that integrates with Coverity to run a full scan and Merge Request scan. Merge Request review comments are only created for new issues that are detected on the feature branch but not the target branch.
The full scan will be triggered by push and merge events on specified branches. Conversely, the Merge Request scan will be triggered by push events to Merge Requests that target those branches. Any new security issues introduced by a Merge Request will be added as review comments. After the scan completes, appropriate security reports and diagnostic logs will be exported as build artifacts.
Prerequisites
- The following readme is recommended:
- Admin access to a GitLab repository.
- Coverity credentials.
- A GitLab Personal Access Token with at least
Developerprivileges andapiaccess is required to allow the pipeline to inject review comments into GitLab Merge Requests. - For security reasons, it is advisable not to store credentials directly in the workflow. The recommended approach is to use masked and hidden variables. Important: It is adviseable that the variables are added as project variables. Group variable inheritance can cause scans to fail under certain conditions. Be sure to set the mask variable flag for
COVERITY_USER,COVERITY_PASSPHRASEandGITLAB_USER_TOKENto avoid exposure in the CI logs. - The following Black Duck Security Scan Template parameters are required to enable injecting review comments into Merge Requests and have been included in the quickstart example:. Important: Merge Request comments will not be injected if these parameters and the required prerequisites are not configured.
Parameter Description Example BRIDGE_COVERITY_PRCOMMENT_ENABLEDWhen true, this enables Merge Request comments."true"BRIDGE_GITLAB_USER_TOKENA GitLab Personal Access Token with at least Developerprivileges andapiaccess to inject review comments.$GITLAB_USER_TOKENNote: The Black Duck Security Scan Template integrates with Coverity via Bridge CLI. Additional scan configuration options not available through the template's parameter set can be specified by defining relevant Bridge CLI environment variables within the workflow job. - Add the following secrets and variables ():
Variable Type Description Example COVERITY_URLMasked Coverity Server URL https://coverity.blackduck.comCOVERITY_USERMasked and hidden Coverity Username USER_NAMECOVERITY_PASSPHRASEMasked and hidden Coverity Passphase PASSPHRASEGITLAB_USER_TOKENMasked and hidden GitLab Personal Access Token with at least Developerprivileges andapiaccess to inject review comments.REPLACE_WITH_YOUR_TOKEN - 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 pipeline parameters to specify build and clean commands.
- See Using Bridge With Compiled Languages for an explanation of the various methods available for configuring Bridge to integrate with Coverity to capture and analyze the build for compiled languages.
Instructions
Troubleshooting and support
coverity_local parameter should be uncommented in the quickstart code example.coverity_local parameter to true enables the full analysis toolkit at the client. Subsequently, the scan and analysis will be performed locally by the pipeline. For further details relating to the different Coverity deployment models supported, please refer to Coverity Deployment Architecture. If a pipeline error is encountered similar to the example below, then it is likely that organization firewall rules maybe restricting access to the template.
- Arrange access with the organization's IT department.
- Use a GitLab self managed runner.