---
title: "GitLab integration"
slug: "gitlab-integration"
updated: 2025-02-24T05:49:22Z
published: 2025-02-24T05:49:22Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://traceabledocs.document360.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab integration

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. For more information on the steps, see [Suites](/docs/suites). The name of this suite is 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:

```yaml
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:

```yaml
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](/v1/docs/gitlab-integration#before-you-begin) section.

![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_gitlab_token_variable_navigation.png)

Add the pipeline that you created, `initAndRun_stop.yml` to **CI/CD**→ **General pipelines** and click on**Save Changes**.

![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_gitlab_pipeline_config.png)
