Configure GitLab access tokens
The gitlab_token variable is required to configure jobs and to submit PR comments.
Generate a GitLab token
To generate a GitLab token:
- Click your repository under the Projects section.
- Select Settings > Access Tokens > Add new token.
- Enter a name for the token in the Note field.
- Select an expiration for the token.
- Select a role.
- Select api (under the Select scopes section).
This is the minimum permission needed to run the scan.
- Click Create project access token.
- Store the token.
Remember to store the token after making it, because GitLab will not save the token for you.
Note:
In the Jenkinsfile, you will need to pass gitlab_token as pipeline input. Or, you can configure it in the global configuration. (Navigate to Dashboard > Manage Jenkins > System, then scroll to the Black Duck Security Scan section. There you will find the field Gitlab Token.)
If gitlab_token is set from both sides, then the pipeline input (Jenkinsfile) values will take precedence.
Webhook creation and configuration for GitLab
For instructions on how to create and configure the webhook for GitLab, click here.