Welcome to the Black Duck Security Bulk Onboarding user guide
This guide helps you get started with Black Duck Security Bulk Onboarding for GitLab. It explains the basic setup process, configuration options, and common operations you can perform while using the application.
Black Duck Security Bulk Onboarding provides automated security scanning capabilities for your GitLab projects, helping you identify vulnerabilities, license compliance issues and security risks in your codebase.
The bulk onboarding solution will generate and deploy a workflow that is merged with selected repositories within a group for conducting scans for supported Black Duck platforms: Black Duck® SCA, Coverity or Polaris.
- Prerequisites: Please read before using the bulk onboarding solution.
- CI/CD Variables setup: Setup variables referenced within the generated workflow file at the group level or subgroup level or for a small selection of projects where the workflow will be deployed. This section includes recommended guidance on configuring a GitLab Personal Access Token to allow the workflow to perform post scan operations, e.g., injecting Merge Request comments, creating Fix Merge Requests.
GitLab CI/CD variables setup
The generated workflow file, by default references variables, secrets and a GitLab Personal Access Token.
This section explains an overview for how to add variables, secrets and token at the workspace and repository level.
Before proceeding, ensure all requirements in the Black Duck Security Prerequisites are met.
Please refer to the appropriate platform documentation for an overview of the required secrets and variables:
Group level configuration (recommended)
Variables specified for a group can be accessed from all projects that belong to the group. You must be an owner to manage group variables.
- Go to GitLab.com
- Click on the GitLab Home cog from the top left of the GitLab page.
- Select Groups from the left navigation bar.
- Select a particular group for which you want to onboard GitLab workflow.
- Select CI/CD from the Settings dropdown menu.
- From the Variables dropdown click on Add variable
- For adding a secret, use Masked or Masked and hidden option
- Uncheck Protect variable from the flags option
- Specify the Key and Value
- Click on Add Variable to save Note: A protected variable in GitLab CI/CD is only available to pipelines running on protected branches or protected tags.
- If Protect variable is unchecked, the variable can be used by pipelines on any branch.
- If Protect variable is checked, the variable will not be available in Merge Request pipelines and will only work on protected branches or tags.
Group variables can be overridden by subgroup/project variables.
Group variables can be accessed in the CI/CD pipeline by all users with the write access for any project (private or public).
You must be an owner of a group to manage variables.
Subgroup level configuration
CI/CD variables added at the subgroup level can be used by any user who has write access in the projects inside the subgroup. To access and configure the subgroup variables, the user must be an owner of that subgroup.
From the subgroup's settings, subgroup variables can be managed in
Project level configuration
Pipeline variables added at the project level can be used by any user who has write access in the project. To access and configure the project variables, the user must be an owner/maintainer of that project.
From the project's settings, project variables can be managed in .
Configure GitLab Personal Access Token
A GitLab Personal Access Token is required to enable the workflow to add Merge Request comments and raise Auto Fix Merge Requests. For details on the supported types of GitLab tokens see Configure GitLab User Token.
GitLab OAuth 2.0 authorization
When first accessing Black Duck Security Bulk Onboarding, a prompt will be displayed to authorize the following permissions:
- Read your personal information
- Access the API on your behalf
Click Authorize Black Duck Security to proceed.
s
Onboarding process
api and read_userTake a moment to review the dashboard components:
- Select projects: Select the projects within a group or personal account where configured scans will be deployed to.
- Configure options: Configure scan options for specific Black Duck platforms such as Black Duck® SCA, Coverity and Polaris.
- Review product-ci.yml: Review a preview of the generated GitLab workflow that will be deployed to the selected projects for performing a Black Duck security scan.Note: When a
product-ci.ymlalready exists in a project, it will replace the existing content. However, if a.gitlab-ci.ymlexists, then the generated configuration will be merged into the existing yml file using an include reference of theproduct-ci.yml. If a.gitlab-ci.ymldoes not exist, a new .gitlab-ci.ymlwill be created along with theproduct-ci.ymlfile and submitted as a Merge Request. - Summary: Summarizes the count of projects where the workflow will be deployed to. At this stage the workflow can be submitted for deployment.
Configure scan workflow
The Dashboard UI can be used to configure which projects within a group or personal account a workflow will be deployed to. A workflow can be configured for the following Black Duck platforms:
- Black Duck® SCA
- Coverity
- Polaris
Step 1: Select projects
Use the Select Projects screen to configure which projects within the group or personal account should be scanned.
- Use the Group or Personal account drop down list to select the group or personal account.Note: The onboarding solution automatically discovers and displays projects based on the selected group or personal account.
- Select the projects that the generated workflow should be configured and deployed to:Note: When a
product-ci.ymlalready exists in a project, it will replace the existing content. However, if a.gitlab-ci.ymlexists, then the generated configuration will be merged into the existing yml file using an include reference of theproduct-ci.yml. If a.gitlab-ci.ymldoes not exist, a new .gitlab-ci.ymlwill be created along with theproduct-ci.ymlfile and submitted as a Merge Request.- All Projects: Configure and deploy the workflow to all projects within the group or personal account.
- Selected projects: Select the projects from a list. Use the following filter operations for assistance with project selection:
- Search: Filter by repository name (at least 3 character should be specified).
Step 2: Configure scan options
The Dashboard can be used to automatically generate a GitLab workflow file based on scan options specified in the
Configure Options screen. The generated GitLab workflow will be deployed to the selected repositories.
The screen illustrated above highlights that the following options can be configured:
- Branches: Scans can be configured to trigger in response to push events and when a Merge Request is created or updated. Use the
push eventsandmerge requesttext boxes to specify which branches will initiate scans for each type of event. - Runner tag: Choose the environment for the GitLab runner. To generate runner OS specific scripts, select Mac/Linux or Windows from the
Runner Configurationoption. By default, a Mac/Linux (Bash) script will be generated. Runner tags are comma-separated, for example:docker,linux,group1-runner.Note: Please select only one type of runner tags (either Mac/Linux or Windows) for the selected projects. If you mix runner types, the workflow may fail because the scripts use different shells (bash vs. PowerShell). - Platform: Select the Black Duck platform for scanning in the project. Supported platforms include Coverity, Black Duck® SCA and Polaris. Upon selection, the Dashboard UI will dynamically update to display platform scan-specific options and instructions, such as which GitLab CI/CD variables are required for the generated workflow to run successfully.
- Scan method: Choose between:
GitLab Template (recommended): Generate a scan workflow that uses Black Duck Security Scan Template.CLI - Black Duck Bridge CLI: Generate a scan workflow that downloads the latest Bridge CLI and uses it directly to perform a security scan.
Note: Ensure all required GitLab CI/CD variables are configured before clicking Next to proceed with generating a scan workflow for review and deployment.
Refer to the Black Duck platform documentation pages for further details of scan configuration options and prerequisites:
Review workflow
The Review product-ci.yml screen allows a generated workflow to be previewed and edited before submission for deployment.
Configure options screen and select a different Black Duck platform. Subsequently, when navigating back to the Review product-ci.yml screen, the generated product-ci.yml will be displayed with the configured options for the selected platform (Black Duck® SCA, Coverity or Polaris).The Review blackducksca-ci.yml screen is illustrated below with an example generated workflow for Black Duck® SCA. Refer to the following documentation pages for sample workflow jobs generated for each Black Duck platform:
The remainder of this section explains the workflow review process.
The Review blackducksca-ci.yml screen displays a GitLab workflow containing a single scan job, specifically added for selected Black Duck platforms.
The workflow is automatically generated for deployment to the selected projects and simplified to include only the minimum fields required (e.g., default values for the product scans are omitted unless specified). When a blackducksca-ci.yml already exists in a project, it will replace the existing content. However, if a .gitlab-ci.yml exists, then the generated configuration will be merged into the existing yml file using include reference of the blackducksca-ci.yml and if .gitlab-ci.yml does not exist, a new .gitlab-ci.yml will be created along with the blackducksca-ci.yml file and submitted as merge request.
Inline editing of the workflow is available by clicking the Edit button. The editor automatically validates the syntax, preventing saves if errors are detected. It also issues warnings for potential issues, such as hardcoded secrets or variables, which do not block saving.
.gitlab-ci.yml file in your project's root.- Review and adjust the generated workflow as needed: Use the Edit button to make direct edits to the workflow.yml file, such as:
- Modify trigger conditions, including which branches will trigger a scan.
- Adjust scan configuration parameters.
- Required credentials and tokens.
- Add custom steps or integrations.
- When required changes have been made, then perform one of the following options:
- Click the Previous button to configure scan options for a different Black Duck platform. Subsequently, when the
Review blackducksca-ci.ymlscreen is revisited a scan job will be created or merged with the workflow for that platform. When ablackducksca-ci.ymlalready exists in a project, it will replace the existing content. However, if a.gitlab-ci.ymlexists, then the generated configuration will be merged into the existing yml file usingincludereference of theblackducksca-ci.ymland if.gitlab-ci.ymldoes not exist, a new.gitlab-ci.ymlwill be created along with theblackducksca-ci.ymlfile and submitted as Merge Request.Note: After editing the workflow, if thePreviousbutton is selected, the UI will warn that the edits you made will be lost permanently. - Click the Next button to confirm that the workflow has been reviewed and all necessary amendments have been made.
- Click the Previous button to configure scan options for a different Black Duck platform. Subsequently, when the
Deploy workflow
The Summary screen displays the count of projects where the blackducksca-ci.yml will be deployed by raising a Merge Request.
- Review the deployment summary: Note: Check that the count of selected repositories and workflow filename (e.g.,
blackducksca-ci.yml) is as expected. Use thePreviousbutton to navigate back to adjust if necessary. - The yml file will be committed as a Merge Request and with necessary changes in
.gitlab-ci.ymlfile. - Click the Submit button and confirm deployment in the modal dialog.
- Monitor the deployment progress in the onboarding summary screen illustrated below, which will update every 10 seconds.
- Review the Failed Projects List for any deployment issues.
Automatic Merge Request creation
Currently GitLab onboarding process is available through creating Merge Requests only. While creating Merge Requests, below approach is followed:
product-ci.yml- Already exists: The existing
product-ci.ymlwill be replaced with the newly generated content. - Does not exist: A new
product-ci.ymlwill be created.
- Already exists: The existing
.gitlab-ci.yml- Already exists: The pipeline setup will be merged into the existing file by adding:
- an
includereference that points to the generatedproduct-ci.yml - a stage name
blackduck_securityinstagessection to queue up the job specified inproduct-ci.yml
- an
- Does not exist: A new
.gitlab-ci.ymlfile will be created and both files will then be submitted together as a merge request.Note: If theproduct-ci.ymlis already referenced inside.gitlab-ci.yml, then there will be no modification in.gitlab-ci.ymlfile content and onlyproduct-ci.ymlwill be submitted as a merge request.
- Already exists: The pipeline setup will be merged into the existing file by adding:
Troubleshooting and support
| Issue type | Issue | Symptoms | Solution |
|---|---|---|---|
| Authentication | OAuth authorization failed | OAuth authorization failed |
|
| Permissions | Insufficient project access | Error: 403 Forbidden when accessing project |
|
| Workflow deployment | Workflow creation failed | Deployment stuck in In Progress status |
|
| Workflow scan execution | Bash/Powershell script injection failed | GitLab pipeline failed |
|