- 22 Apr 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
GitLab integration
- Updated on 22 Apr 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
GitLab is a web-based platform that provides tools for managing and collaborating on software development projects. It is primarily used for version control and source code management but also offers features for project planning, continuous integration, continuous delivery (CI/CD), issue tracking, and more. Traceable provides you with a base CI/CD pipeline that you can integrate to run AST scans.
Before you begin
Make a note of the following before proceeding with the integration:
Ensure you have the required permissions in GitLab to add the Traceable extension and the various configurations.
Make sure that your CI/CD pipeline is already available.
Ensure you have identified the repository to which you wish to add the Traceable extension.
The topic assumes you have reasonable knowledge of GitLab and its functions and features.
Copy the token. This would be required during AST extension configuration. Navigate to My Account → My Preferences → API Tokens.
Make sure that you already have a scan suite configured in AST. The name of this suite would be used later to configure the AST extension in your pipeline.
Configuration
The pipeline needs to be extended to run AST in the GitLab pipeline. Following is a sample code to extend the pipeline:
include:
- remote: 'https://gitlab.com/traceableai/ast/-/raw/main/init-ast-scan.yml'
Once you have extended the pipeline, you can create a pipeline (initAndRun_stop.yml
) to run jobs and stages for AST. The following is a sample pipeline:
include:
- remote: 'https://gitlab.com/traceableai/ast/-/raw/main/init-ast-scan.yml'
stages:
- ast-init-stage
- ast-run-stage
ast-job1:
stage: ast-init-stage
variables:
STEP_NAME: "initAndRun"
SCAN_SUITE: "traceable-test"
TRACEABLE_SERVER: "api.traceable.ai"
CLIENT_SCAN_TOKEN: $token
extends: .initializing_job
ast-job2:
stage: ast-run-stage
variables:
STEP_NAME: "stop"
TRACEABLE_SERVER: "api.traceable.ai"
extends: .running_job
You can create the $token
variable by navigating to CI/CD → Variables. Click on Add variable and fill in the key and value for the variable. The token's value would be the one you copied from Traceable Platform in the Before you begin section.
Add the pipeline that you created, initAndRun_stop.yml
to CI/CD → General pipelines and click on Save Changes.