Skip to content

DataDog/deployment-gate-github-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Datadog Deployment Gate GitHub Action

Deployment Gates allow you to reduce the likelihood and impact of incidents caused by deployments. This action provides a simple way to integrate Datadog Deployment Gates into your CI/CD pipeline.

You can learn more in the Deployment Gates documentation: https://docs.datadoghq.com/deployment_gates/

Prerequisites

Before using this action, you need to:

  1. Set up Deployment Gates in your Datadog account. If you have not, join the preview here: https://www.datadoghq.com/product-preview/deployment-gates/
  2. Have a Datadog API key
  3. Have a Datadog Application key with at least the cd_visibility_read scope.
  4. Configure your Deployment Gates for your services and environments on the Datadog UI.

Usage

Basic Example

name: Deploy with Datadog Deployment Gate

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v5
    
        - name: Deploy Canary
        run: |
          echo "Deploying canary release for service:'my-service' in 'production'. Version 1.0.1"
          # Your deployment commands here

      - name: Evaluate Deployment Gate
        uses: DataDog/deployment-gate-github-action@v1
        env:
          DD_API_KEY: ${{ secrets.DD_API_KEY }}
          DD_APP_KEY: ${{ secrets.DD_APP_KEY }}
        with:
          service: 'my-service'
          env: 'production'
      
      - name: Deploy
        if: success()
        run: |
          echo "Deployment Gate passed, proceeding with deployment"
          # Your deployment commands here

Environment Variables

The following environment variables are required:

Variable Description Required
DD_API_KEY Datadog API key
DD_APP_KEY Datadog application key
DD_SITE Datadog site (e.g., datadoghq.com, datadoghq.eu) ❌ (defaults to datadoghq.com)

Inputs

Input Description Required Default
service Name of the service being deployed
env Deployment environment (e.g., staging, production)
version Version being deployed (required for APM Faulty Deployment Detection rules)
identifier Custom identifier for the Deployment Gate evaluation
apm-primary-tag Primary tag to scope down APM analysis for APM Faulty Deployment Detection rules (e.g., region:us-central-1)
timeout Command timeout in seconds
fail-on-error When true, the script will consider the gate as failed when timeout is reached or unexpected errors occur calling the Datadog APIs. false

Outputs

This action uses the native datadog-ci command which handles all output internally. The action will:

  • Succeed if the Deployment Gate passes
  • Fail if the Deployment Gate fails or encounters an error

This action provides detailed output in the logs, including:

  • Gate evaluation status
  • Individual rule results
  • Links to view results in Datadog UI
  • Evaluation timing and polling information

Error Handling

The action leverages the native datadog-ci error handling:

  • Pass if the Deployment Gate evaluation succeeds
  • Fail if the Deployment Gate evaluation fails
  • Fail if there are authentication or configuration errors
  • 🔄 Automatic polling until evaluation completes
  • ⏱️ Built-in timeout handling with sensible defaults

Troubleshooting

Common Issues

  1. Authentication Errors

  2. Gate Not Found

    • Verify the service name and environment match your Datadog configuration
    • Check that Deployment Gates are properly configured in Datadog

Contributing

To contribute to this project, see the CONTRIBUTING file.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Support

For issues related to:

About

Evaluate a Datadog deployment gate

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •