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

# Jenkins

## Overview{% #overview %}

Add Continuous Testing tests to your Jenkins environment.

Datadog recommends discussing with your SRE and Infrastructure teams to determine a solution that models your existing Jenkins architecture and customizes an installation that fits your business requirements.

## Setup{% #setup %}

To use Docker in your Jenkins environment, see [Using Docker with Pipeline](https://www.jenkins.io/doc/book/pipeline/docker/#using-docker-with-pipeline).

### Prerequisites{% #prerequisites %}

- Node.js v10.24.1+
- A global JSON configuration file uploaded to your Jenkins instance through the [Config File Provider](https://plugins.jenkins.io/config-file-provider/). You need this file to define the global properties for your Synthetics test setup.

You can store environment variables directly within the global configuration file or [use credentials](https://www.jenkins.io/doc/book/using/using-credentials/#adding-new-global-credentials). For more information about test configurations, see [Configure tests](https://docs.datadoghq.com/continuous_testing/cicd_integrations/configuration#configure-tests).

### Run the `@datadog/datadog-ci` package{% #run-the-datadogdatadog-ci-package %}

Install and run the Node.js and npm packages within your Jenkins environment with the Jenkins Node.js plugin.

For more information about the existing Datadog-Jenkins integration, see [Set up Tracing on a Jenkins Pipeline](https://docs.datadoghq.com/continuous_integration/pipelines/jenkins/).

### Add a Node.js installation{% #add-a-nodejs-installation %}

Navigate to the global Jenkins Configuration panel and add a Node.js installation.

{% image
   source="https://datadog-docs.imgix.net/images/synthetics/cicd_integrations/jenkins/nodejs-installation.ee7f12189a34c9a48aeecd02354f1d70.png?auto=format"
   alt="Node.js Installations in Jenkins" /%}

Install `@datadog/datadog-ci` globally for all relevant Node.js installations.

#### Tags{% #tags %}

To run Continuous Testing tests with tags in a Jenkins Declarative pipeline:

```groovy
pipeline {
   agent any
   stages {
       stage('Run e2e tests') {
           steps {
               withCredentials([string(credentialsId: 'datadog-api-key', variable: 'DATADOG_API_KEY'), string(credentialsId: 'datadog-app-key', variable: 'DATADOG_APP_KEY')]) {
                   nodejs(nodeJSInstallationName: 'Node 10.24.x') {
                       configFileProvider(
                           [configFile(fileId: 'config-file-id', variable: 'DATADOG_CI_CONFIG')]) {
                           sh 'datadog-ci synthetics run-tests -s "tag:e2e" --config $DATADOG_CI_CONFIG'
                       }
                   }
               }
           }
       }
   }
```

#### Custom test file{% #custom-test-file %}

To run Continuous Testing tests with a custom test file in a Jenkins Declarative pipeline:

```groovy
pipeline {
   agent any
   stages {
       stage('Run e2e tests') {
           steps {
               withCredentials([string(credentialsId: 'datadog-api-key', variable: 'DATADOG_API_KEY'), string(credentialsId: 'datadog-app-key', variable: 'DATADOG_APP_KEY')]) {
                   nodejs(nodeJSInstallationName: 'Node 10.24.x') {
                       configFileProvider(
                           [configFile(fileId: 'config-file-id', variable: 'DATADOG_CI_CONFIG'), configFile(fileId: 'test-file-id', variable: 'DATADOG_CI_TEST_FILE')]) {
                           sh 'datadog-ci synthetics run-tests -f $DATADOG_CI_TEST_FILE --config $DATADOG_CI_CONFIG'
                       }
                   }
               }
           }
       }
   }
}
```

You can expect the following output:

{% image
   source="https://datadog-docs.imgix.net/images/synthetics/cicd_integrations/jenkins/example-test-run.fba83af26191c9f12025fb2ac8167b68.png?auto=format"
   alt="Example Test Run in Jenkins" /%}

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

- [Run Datadog Synthetic tests in your Jenkins pipelines](https://www.datadoghq.com/blog/jenkins-testing/)
- [Set up Tracing on a Jenkins pipeline](https://docs.datadoghq.com/continuous_integration/setup_pipelines/jenkins/)
