---
title: GitLab
description: >-
  Configure your GitLab instance to run Continuous Testing tests in your CI/CD
  pipelines.
breadcrumbs: Docs > Continuous Testing > Continuous Testing and CI/CD > GitLab
---

# GitLab

## Overview{% #overview %}

Run Continuous Testing tests in your [GitLab](https://docs.datadoghq.com/integrations/gitlab.md) pipelines, block deployments, and trigger rollbacks to ensure your code is added in production when your essential business workflows are functioning as expected.

To integrate Continuous Testing tests with a [GitLab pipeline](https://docs.gitlab.com/ee/ci/pipelines/), you can use the [datadog-ci npm package](https://www.npmjs.com/package/@datadog/datadog-ci).

## Setup{% #setup %}

To get started:

1. Add your Datadog API and application keys as variables in your GitLab project.
1. Ensure your GitLab runner has a version of Node.js >= 10.24.1 installed.

For more information, see [CI/CD Integrations Configuration](https://docs.datadoghq.com/synthetics/cicd_integrations/configuration.md).

## Simple configuration{% #simple-configuration %}

### Run tests using test IDs{% #run-tests-using-test-ids %}

```yaml
stages:
  - test
synthetic-tests:
  stage: test
  script:
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" --public-id xtf-w5p-z5n --public-id eif-van-tu7
```

### Run tests using tags{% #run-tests-using-tags %}

```yaml
stages:
  - test
synthetic-tests:
  stage: test
  script:
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" -s 'tag:e2e-tests'
```

### Run tests using variable overrides{% #run-tests-using-variable-overrides %}

If you have different test users or data specific to your CI/CD environment, you can override these variables with the `-v` command. For more information, [see the Synthetics command](https://github.com/DataDog/datadog-ci/tree/master/packages/plugin-synthetics) in the `datadog-ci` NPM package.

```yaml
stages:
  - test
synthetic-tests:
  stage: test
  script:
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" -s 'tag:e2e-tests' -v PASSWORD="$PASSWORD"
```

## Advanced configuration{% #advanced-configuration %}

### Run tests using a custom configuration file{% #run-tests-using-a-custom-configuration-file %}

Add a custom `config.json` file to your pipeline repository and access it in your pipeline configuration.

```yaml
stages:
  - test
synthetic-tests:
  stage: test
  script:
    - npm install -g @datadog/datadog-ci
    - datadog-ci synthetics run-tests --apiKey "$DATADOG_API_KEY" --appKey "$DATADOG_APP_KEY" --config synthetics_global.json -f synthetic_test.json
```

### Test output{% #test-output %}

This example demonstrates the pipeline has identified the configuration file and is running the test:

{% image
   source="https://docs.dd-static.net/images/synthetics/cicd_integrations/gitlab/synthetic_test_run.6d3a09de1a562425b6ee8178f70cffd4.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/synthetics/cicd_integrations/gitlab/synthetic_test_run.6d3a09de1a562425b6ee8178f70cffd4.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A Synthetic test running in GitLab" /%}

A successful test output returns the following in GitLab:

{% image
   source="https://docs.dd-static.net/images/synthetics/cicd_integrations/gitlab/successful_test_run.e629fc05057e852a12e84550fe3b7ed6.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/synthetics/cicd_integrations/gitlab/successful_test_run.e629fc05057e852a12e84550fe3b7ed6.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A successful Synthetic test run result in a GitLab pipeline" /%}

## Further reading{% #further-reading %}

- [Run Datadog Synthetic tests in your GitLab pipelines](https://www.datadoghq.com/blog/monitor-ci-pipelines/)
- [Set up Tracing on a GitLab Pipeline](https://docs.datadoghq.com/continuous_integration/pipelines/gitlab.md)
