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/
Before using this action, you need to:
- Set up Deployment Gates in your Datadog account. If you have not, join the preview here: https://www.datadoghq.com/product-preview/deployment-gates/
- Have a Datadog API key
- Have a Datadog Application key with at least the
cd_visibility_read
scope. - Configure your Deployment Gates for your services and environments on the Datadog UI.
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
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 ) |
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 |
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
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
-
Authentication Errors
- Verify your
DD_API_KEY
andDD_APP_KEY
are correct - Ensure the Application Key have the necessary
cd_visibility_read
permission - Ensure you have access to the Deployment Gates preview: https://app.datadoghq.com/ci/deployment-gates/getting-started
- Verify your
-
Gate Not Found
- Verify the service name and environment match your Datadog configuration
- Check that Deployment Gates are properly configured in Datadog
To contribute to this project, see the CONTRIBUTING file.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
For issues related to:
- This GitHub Action: Open an issue in this repository
- Datadog Deployment Gates: Contact Datadog Support
- datadog-ci CLI: Check the datadog-ci repository