Skip to content

About

Use Datadog from your CI.

Topics

Resources

Contributing

Stars

163 stars

Watchers

530 watching

Forks

Latest commit

Β 

History

6,220 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Datadog CI

NPM Version Continuous Integration License Node.js Version

Execute commands from your Continuous Integration (CI) and Continuous Delivery (CD) pipelines to integrate with existing Datadog products.

See the Usage section for a list of available commands.

How to install the CLI

The datadog-ci CLI can be installed in three ways:

To install the NPM package:

# NPM
npm install --save-dev @datadog/datadog-ci

# Yarn
yarn add --dev @datadog/datadog-ci

If you want to use datadog-ci without installing it in your project:

# Install globally with NPM
npm install -g @datadog/datadog-ci

# ...or with Yarn 1 (Classic)
yarn global add @datadog/datadog-ci

# ...or run a one-shot install with NPM
npx @datadog/datadog-ci@v5 [scope]

# or with Yarn
yarn dlx @datadog/datadog-ci@v5 [scope]

Warning

Datadog recommends pinning an exact version of datadog-ci to avoid being impacted by breaking changes introduced in major versions of datadog-ci, or being vulnerable to supply chain attacks.

Installing a plugin

Plugins are NPM packages that were split from the main @datadog/datadog-ci NPM package to reduce its installation size.

If you are using the NPM package, you can manage plugins with the following commands:

# List available plugins
datadog-ci plugin list

# Install a plugin
datadog-ci plugin install <scope>

If you are using the standalone binary, all plugins are already included, so you don't need to install them separately.

Plugin auto-installation

For backward compatibility, running a command that requires a plugin automatically installs the plugin if it is not already installed.

Warning

Datadog recommends explicitly installing plugins with datadog-ci plugin install <scope> to skip auto-installation. You can also disable auto-installation with DISABLE_PLUGIN_AUTO_INSTALL=1.

Overriding the plugin version

By default, datadog-ci plugin install installs a plugin version that matches the version of datadog-ci you are running. To override that behavior, use the PLUGIN_INSTALL_VERSION_OVERRIDE environment variable:

PLUGIN_INSTALL_VERSION_OVERRIDE=5.23.0 datadog-ci plugin install synthetics

This environment variable is also respected when datadog-ci auto-installs a missing plugin.

The value must be an exact semantic version (X.Y.Z), without ranges such as ^5.23.0.

Usage

Usage: datadog-ci <scope> <command> [options]

The following <scope> and <command> values are available.

aas

README: πŸ“š | Documentation: πŸ”— | Plugin: @datadog/datadog-ci-plugin-aas

  • instrument: Apply Datadog instrumentation to the given Azure Web Apps (or slots).
  • uninstrument: Revert Datadog instrumentation from the given Azure Web Apps (or slots).

cloud-run

README: πŸ“š | Documentation: πŸ”— | Plugin: @datadog/datadog-ci-plugin-cloud-run

  • flare: Troubleshoot your issues with Cloud Run service configuration.
  • instrument: Apply Datadog instrumentation to the given Cloud Run Services.
  • uninstrument: Revert Datadog instrumentation from the given Cloud Run Services.

container-app

README: πŸ“š | Documentation: πŸ”— | Plugin: @datadog/datadog-ci-plugin-container-app

  • instrument: Apply Datadog instrumentation to Azure Container Apps.
  • uninstrument: Revert Datadog instrumentation from Azure Container Apps.

coverage

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload code coverage report files to Datadog.

dora

README: πŸ“š | Documentation: πŸ”—

  • deployment: Send a new deployment event for DORA Metrics to Datadog.

dsyms

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload iOS dSYM files for Error Tracking (macOS only).

ecs-fargate

README: πŸ“š | Documentation: πŸ”— | Plugin: @datadog/datadog-ci-plugin-ecs-fargate

  • instrument: Apply Datadog instrumentation to an Amazon ECS Fargate task definition.
  • uninstrument: Revert Datadog instrumentation from an Amazon ECS Fargate task definition.

flutter-symbols

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Flutter symbols for Error Tracking.

gate

README: πŸ“š | Documentation: πŸ”—

Warning

Deprecated: Datadog Quality Gates is being replaced by the new PR Gates in 2026. To start the migration, please fill out this form: https://forms.gle/qnhANsE1ABtHrjqz9

Learn more about PR Gates: https://docs.datadoghq.com/pr_gates

  • evaluate: Evaluate Quality Gates rules in Datadog.

git-metadata

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Git metadata for the Source Code Integration.

junit

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload JUnit test reports for Test Visibility.

lambda

README: πŸ“š | Documentation: πŸ”— | Plugin: @datadog/datadog-ci-plugin-lambda

  • flare: Troubleshoot your issues with Datadog instrumentation on your AWS Lambda functions.
  • instrument: Apply Datadog instrumentation to the given AWS Lambda functions.
  • uninstrument: Revert Datadog instrumentation from the given AWS Lambda functions.

measure

README: πŸ“š | Documentation: πŸ”—

  • Add measures to a CI Visibility pipeline trace or job span in Datadog.

pe-symbols

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Windows PE debug info files for Profiling.

ppdb-symbols

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload .NET MAUI Portable PDB files for Error Tracking.

react-native

README: πŸ“š | Documentation: πŸ”—

  • codepush: Upload React Native CodePush sourcemaps for Error Tracking. πŸ”—
  • upload: Upload React Native sourcemaps for Error Tracking.
  • xcode: Upload React Native sourcemaps for Error Tracking from the XCode bundle build phase.

sarif

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Static Analysis Results Interchange Format (SARIF) reports to Datadog.

sbom

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Software Bill of Materials (SBOM) files to Datadog.

sourcemaps

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload JavaScript sourcemaps for Error Tracking.

stepfunctions

README: πŸ“š | Documentation: πŸ”— | Plugin: @datadog/datadog-ci-plugin-stepfunctions

  • instrument: Instrument AWS Step Function with Datadog to get logs and traces.
  • uninstrument: Uninstrument AWS Step Function.

synthetics

README: πŸ“š | Plugin: @datadog/datadog-ci-plugin-synthetics

  • run-tests: Run Continuous Testing tests from the CI. πŸ”—
  • upload-application: Upload a new version to an existing mobile application in Datadog. πŸ”—

tag

README: πŸ“š | Documentation: πŸ”—

  • Add custom tags to a CI Visibility pipeline trace or job span in Datadog.

terraform

README: πŸ“š | Plugin: @datadog/datadog-ci-plugin-terraform

  • upload: Upload Terraform plan or state files to Datadog for enhanced cloud-to-code mapping and policy evaluation.

trace

README: πŸ“š | Documentation: πŸ”—

  • Add custom commands to a CI Visibility pipeline in Datadog.
  • span (πŸ“š): Report a custom span to a CI Visibility pipeline in Datadog without wrapping a command.

unity-symbols

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Unity symbols for Error Tracking.

Beta commands

The following are beta commands, you can enable them with with DD_BETA_COMMANDS_ENABLED=1:

deployment

README: πŸ“š | Documentation: πŸ”—

  • mark: Mark a CI job as a deployment.
  • correlate: Correlate GitOps CD deployments with application repositories CI pipelines. πŸ”—
  • correlate-image: Correlate an image from a CD provider with its source commit. πŸ”—
  • gate: Evaluate a Deployment Gate. πŸ”—

elf-symbols

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload Elf debug info files for Profiling.

wasm-symbols

README: πŸ“š | Documentation: πŸ”—

  • upload: Upload WebAssembly (.wasm) debug info files for Error Tracking.

wasm-sourcemaps

README: πŸ“š

  • upload: Upload WebAssembly source maps (*.wasm.map) for Error Tracking, identified by service, version, and module URL.

Authentication

datadog-ci reads Datadog credentials from environment variables:

Credential Environment variables Sent as
API key DD_API_KEY or DATADOG_API_KEY DD-API-KEY header
Application key DD_APP_KEY or DATADOG_APP_KEY DD-APPLICATION-KEY header
Access token DD_ACCESS_TOKEN or DATADOG_ACCESS_TOKEN Authorization: Bearer <token> header

When both forms of a variable are set, DATADOG_* takes precedence.

Commands that communicate with Datadog fall into two groups: commands that only send telemetry to your org, and commands that call Datadog API endpoints, which can also send telemetry.

Run datadog-ci <command> --help to see which credentials a command needs.

  • Sending telemetry requires an API key only.
  • Calling Datadog API endpoints requires either an API key and an application key, or an access token.

Note

Use a long-lived API key for Serverless instrument commands that save an API key in the instrumented service (aas, cloud-run, container-app, ecs-fargate, and lambda).

Short-lived keys from an intake mapping would pass the initial setup validation, but your service would silently stop sending telemetry after the key expires.

GitHub Actions with Workload Identity Federation

The datadog-workload-identity-federation-github-action exchanges the workflow's GitHub OIDC token for Datadog credentials, so no Datadog keys are stored as GitHub secrets. Its intake action returns an API key (api_key output) and its identity action returns an access token (access_token output). Both need the id-token: write permission and the UUID of your Datadog organization.

Before using it, an administrator on your Datadog organization must create mappings with the GitHub OIDC token claims you want to allow. For example, to allow any branch of a workflow in your repository:

Claim Pattern
sub repo:<owner>/<repo>:ref:refs/heads/.*
job_workflow_ref <owner>/<repo>/\.github/workflows/<workflow>\.yml@.*
repository <owner>/<repo>

Then get the credentials in your workflow:

jobs:
  datadog:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write # Needed to federate the GitHub OIDC token.
    steps:
      - uses: actions/checkout@v6

      # Intake mapping: a short-lived API key for data uploads.
      - name: Get a Datadog API key
        id: datadog-intake
        uses: DataDog/datadog-workload-identity-federation-github-action/intake@v1
        with:
          org_uuid: <your-org-uuid>
          site: datadoghq.com

      # Identity mapping: an access token for org actions.
      - name: Get a Datadog access token
        id: datadog-identity
        uses: DataDog/datadog-workload-identity-federation-github-action/identity@v1
        with:
          org_uuid: <your-org-uuid>
          site: datadoghq.com

      - name: Upload git metadata (API key)
        run: npx @datadog/datadog-ci git-metadata upload
        env:
          DD_API_KEY: ${{ steps.datadog-intake.outputs.api_key }}
          DD_SITE: datadoghq.com

      - name: Run Synthetic tests (access token)
        run: npx @datadog/datadog-ci synthetics run-tests
        env:
          DD_ACCESS_TOKEN: ${{ steps.datadog-identity.outputs.access_token }}
          DD_SITE: datadoghq.com

FIPS support

The fips option allows datadog-ci to use a FIPS cryptographic module provider if the OpenSSL library installed on the host system provides it.

Note: datadog-ci cannot assert if such a provider is available, and doesn't throw any error if the provider is not FIPS validated.

Node.js versions below 17 are incompatible with OpenSSL 3, which provides FIPS support. If you are using a Node.js version below 17, enabling the fips option causes the command to throw an error. The option fips-ignore-error ignores this error.

fips

Enable datadog-ci FIPS support if a FIPS validated provider is installed on the host system. If you do not have a FIPS provider installed, datadog-ci does not raise an error.

  • ENV variable: DATADOG_FIPS=true
  • CLI param: --fips

fips-ignore-error

Ignore Node.js errors if FIPS cannot be enabled on the host system.

Note: the absence of an error doesn't indicate that FIPS is enabled successfully.

  • ENV variable: DATADOG_FIPS_IGNORE_ERROR=true
  • CLI param: --fips-ignore-error

Version banner

Every invocation prints a datadog-ci v<version> banner to stderr. To silence it β€” for example to keep CI logs quiet when the CLI runs many times β€” set:

  • ENV variable: DD_CI_SKIP_VERSION_BANNER=true

More ways to install the CLI

Standalone binary

If installing Node.js in the CI is an issue, you can download datadog-ci as a standalone binary:

  • It's built against the official Node.js distribution for supported architectures and attached to GitHub releases.
  • It includes all plugins, so you don't need to install them separately.

Supported architectures:

  • linux-x64
  • linux-arm64
  • alpine-x64
  • alpine-arm64
  • darwin-x64 (MacOS)
  • darwin-arm64 (MacOS)
  • win-x64 (Windows)

Warning

Using strip to remove debugging symbols from the standalone binary as an attempt to make it smaller may cause segmentation faults when running datadog-ci. See nodejs/postject#90.

Note

To determine the version when unable to run datadog-ci --version (for example, because of segmentation faults or an architecture mismatch), run grep --text STANDALONE_BINARY_VERSION path/to/datadog-ci.

To install the standalone binary:

Linux

# Linux x64
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

# Linux arm64
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-arm64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

Alpine

# Alpine x64
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_alpine-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

# Alpine arm64
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_alpine-arm64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

MacOS

# MacOS x64
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_darwin-x64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

# MacOS arm64
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_darwin-arm64" --output "/usr/local/bin/datadog-ci" && chmod +x /usr/local/bin/datadog-ci

Windows

# Windows x64
Invoke-WebRequest -Uri "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_win-x64" -OutFile "datadog-ci.exe"

Then, you can run datadog-ci commands normally:

datadog-ci version

Container image

To run datadog-ci from a container, you can use the datadog/ci image available in Docker Hub as well as the public Amazon ECR and Google GC registries.

docker pull datadog/ci

This example demonstrates how to run a command using the container and passing in the API and app keys:

export DD_API_KEY=$(cat /secret/dd_api_key)
export DD_APP_KEY=$(cat /secret/dd_app_key)
docker run --rm -it -v $(pwd):/w -e DD_API_KEY -e DD_APP_KEY datadog/ci <command> [<subcommand>] [options]

Building your own container image

You can build an image using the provided Dockerfile:

cd container
docker build --tag datadog-ci .

Optionally, you can use the VERSION build argument to build an image for a specific version:

docker build --build-arg "VERSION=v3.9.0" --tag datadog-ci .

Migration guide

If you are upgrading from a previous major version, read our MIGRATING.md document to understand the changes and how to adapt your scripts.

Development

Before contributing to this open source project, read our CONTRIBUTING.md document.

License

Apache License, v2.0

About

Use Datadog from your CI.

Topics

Resources

Contributing

Stars

163 stars

Watchers

530 watching

Forks

Releases

Used by

Contributors

Languages