This quickstart explains how to set up the Black Duck Security Scan Action to run a Coverity full scan and Pull Request scan for branches in a repository.
The full scan will be triggered by push and merge events on specified branches. Full scan issues will be uploaded to a Coverity Connect instance as a snapshot within a stream. Conversely, the Pull Request scan will be triggered by push events to Pull Requests that target specific branches. Pull Request review comments are only created for new issues created that are detected on the feature branch but not the target branch. After the scan completes, diagnostic logs and report will be exported as GitHub build artifacts.
Prerequisites
- The following reading is recommended:
- Admin access to a GitHub repository.
- Coverity credentials.
- To enable the Black Duck Security Scan Action to add Pull Request Comments, a GitHub Personal Access Token is required.
- The following Black Duck Security Scan Action parameters are required to enable inject review comments into Pull Requests. Important: Pull Request comments will not be injected if these parameters and the required prerequisites are not configured.
Parameter Description Example coverity_prComment_enabledWhen true, this enables Pull Request comments."true"github_tokenA GitHub Personal Access Token with workflow read and write permission. Required to inject review comments. ${{ secrets.GITHUB_TOKEN }}if using the built inGITHUB_TOKENor${{ secrets.MY_PAT_TOKEN $}}to reference a custom token.Note: The Black Duck Security Scan Action integrates with Coverity via Bridge CLI. Additional scan configuration options not available through the action's parameter set can be specified by defining relevant Bridge CLI environment variables within the workflow job. - Add the following secrets and variables (): Important: For security reasons, it is advisable not to store credentials, tokens and secrets directly in the workflow. The recommended approach is to use secrets.
Variable Type Description Example COVERITY_URLVariable Coverity Server URL https://coverity.blackduck.com COVERITY_USERSecret Coverity Username REPLACE_WITH_YOUR_USERNAMECOVERITY_PASSPHRASESecret Active Coverity Authentication Key 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
If a workflow error is encountered similar to the example below, then the
coverity_local parameter should be uncommented in the quickstart code example.Attention: ERROR: Failed to retrieve tool information details: Fetch tool information: received unexpected response status code '500' from Connect API
In this scenario either scan services are not enabled or a Coverity version prior to 2022.3 is deployed. The default behavior is that the workflow uses the Coverity thin client to upload artifacts, with the analysis performed at the server. Setting the coverity_local parameter to true enables the full analysis at the client. Subsequently, the scan and analysis will be performed locally by the workflow. For further details relating to the different Coverity deployment models supported, please refer to Coverity Deployment Architecture.