Black Duck platforms that use Coverity to perform SAST assessments (Polaris, Software Risk Manager and Coverity itself) require additional configuration for compiled languages to capture and analyze compilation processes by specifying build and clean commands.
| Configuration method | Description | Use when... |
|---|---|---|
| Pipeline parameters | Include Bridge build and clean parameters in the workflow file. | Simplest method:
|
| Configuration file | Coverity Configuration File (coverity.yml) that contains build and clean commands along with any other Coverity configurations. |
|
| Pipeline args parameter |
Pass the clean and build commands, and any other arguments needed, to the Coverity CLI in the workflow file. |
|
Pipeline clean and build parameters
The simplest configuration is provided by specifying the clean and build parameters directly within the Black Duck Security Scan configuration.
This approach is recommended when a coverity.yaml file is not present and no additional Coverity configuration is required.
| Platform | Coverity clean parameter | Coverity build parameter |
|---|---|---|
|
coverity_clean_command |
coverity_build_command |
|
BRIDGE_COVERITY_CLEAN_COMMAND |
BRIDGE_COVERITY_BUILD_COMMAND |
Example:
name: coverity-action
on:
push:
branches: [main, master, develop, stage, release]
pull_request:
branches: [main, master, develop, stage, release]
workflow_dispatch:
jobs:
coverity:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Coverity Scan
uses: blackduck-inc/black-duck-security-scan@v2
with:
### SCANNING: Required fields
coverity_url: ${{ vars.COVERITY_URL }}
coverity_user: ${{ secrets.COVERITY_USER }}
coverity_passphrase: ${{ secrets.COVERITY_PASSPHRASE }}
### POLICY ENFORCEMENT: Break build on full scan when encounter outstanding issues
coverity_policy_view: ${{ github.event_name != 'pull_request' && 'Outstanding Issues' || '' }}
### PULL REQUEST COMMENTS:
coverity_prComment_enabled: true
# Required when PR comments is enabled
github_token: ${{ secrets.GITHUB_TOKEN }}
### Perform local analysis with full toolkit
# coverity_local: true
### COVERITY: Build commands for compiled languages
coverity_build_command: mvn -B -DskipTests package
coverity_clean_command: mvn -B clean
## OPTIONAL DIAGNOSTICS: Upload logs as build artifact if true
include_diagnostics: false
Coverity configuration file
Add clean and build commands to a coverity.yaml file if the file already exists and/or additional Coverity configuration options are required.
Default coverity.yaml file location
Bridge searches for a coverity.yaml file in the repository root by default. To use a different path, set the configuration parameter appropriate for your SCM platform (see table below).
| SCM platform | Parameter |
|---|---|
|
coverity_config_path |
|
BRIDGE_COVERITY_CONFIG_PATH |
Example:
capture:
build:
clean-command: mvn -B clean
build-command: mvn -B -DskipTests package
Consult this guide for further language examples.
Pipeline Args parameter
CLI arguments can be passed to the Coverity CLI directly from the Black Duck Security Scan plugin using a configuration parameter. The configuration parameter is set as an argument string.
Use the pipeline args parameter to specify build and clean commands with additional Coverity configuration parameters.
| Platform | Coverity CLI arguments parameter |
|---|---|
|
coverity_args |
|
BRIDGE_COVERITY_ARGS |
Example:
name: coverity-action
on:
push:
branches: [main, master, develop, stage, release]
pull_request:
branches: [main, master, develop, stage, release]
workflow_dispatch:
jobs:
coverity:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Coverity Scan
uses: blackduck-inc/black-duck-security-scan@v2
with:
### SCANNING: Required fields
coverity_url: ${{ vars.COVERITY_URL }}
coverity_user: ${{ secrets.COVERITY_USER }}
coverity_passphrase: ${{ secrets.COVERITY_PASSPHRASE }}
### POLICY ENFORCEMENT: Break build on full scan when encountering outstanding issues
coverity_policy_view: ${{ github.event_name != 'pull_request' && 'Outstanding Issues' || '' }}
### PULL REQUEST COMMENTS:
coverity_prComment_enabled: true
# Required when PR comments are enabled
github_token: ${{ secrets.GITHUB_TOKEN }}
### COVERITY: Build Arguments for compiled languages
coverity_args: -o capture.build.clean-command="mvn clean" -o capture.build.build-command="mvn -B -DskipTests package"
## OPTIONAL DIAGNOSTICS: Upload logs as build artifact if true
include_diagnostics: false