Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 152 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29382,6 +29382,25 @@ components:
data:
$ref: "#/components/schemas/ListDeploymentRuleResponseData"
type: object
DeploymentGatesEvaluationConfiguration:
description: |-
Inline rule definitions for a deployment gate evaluation. When provided, rules are evaluated
directly from this configuration instead of using the pre-configured gate rules.
At least one rule is required.
properties:
dry_run:
description: Gate-level dry run. When enabled, the rules are evaluated normally but the gate always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
rules:
description: The list of rules to evaluate. At least one rule is required.
items:
$ref: "#/components/schemas/DeploymentGatesEvaluationRule"
minItems: 1
type: array
required:
- rules
type: object
DeploymentGatesEvaluationRequest:
description: Request body for triggering a deployment gate evaluation.
properties:
Expand All @@ -29391,8 +29410,13 @@ components:
- data
type: object
DeploymentGatesEvaluationRequestAttributes:
description: Attributes for a deployment gate evaluation request.
description: |-
Attributes for a deployment gate evaluation request.
When `configuration` is provided, rules are evaluated inline from that configuration.
When omitted, rules are resolved from the pre-configured gate for the given service and environment.
properties:
configuration:
$ref: "#/components/schemas/DeploymentGatesEvaluationConfiguration"
env:
description: The environment of the deployment.
example: "staging"
Expand Down Expand Up @@ -29562,6 +29586,60 @@ components:
type: string
x-enum-varnames:
- DEPLOYMENT_GATES_EVALUATION_RESULT_RESPONSE
DeploymentGatesEvaluationRule:
description: A rule to evaluate as part of a deployment gate evaluation.
discriminator:
mapping:
faulty_deployment_detection: "#/components/schemas/DeploymentGatesFDDRule"
monitor: "#/components/schemas/DeploymentGatesMonitorRule"
propertyName: type
oneOf:
- $ref: "#/components/schemas/DeploymentGatesMonitorRule"
- $ref: "#/components/schemas/DeploymentGatesFDDRule"
DeploymentGatesFDDRule:
description: A faulty deployment detection rule to evaluate as part of a deployment gate evaluation.
properties:
dry_run:
description: Rule-level dry run. When enabled, the rule is evaluated normally but it always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
name:
description: Human-readable name for this rule.
example: "apm faulty deployment"
type: string
options:
$ref: "#/components/schemas/DeploymentGatesFDDRuleOptions"
type:
$ref: "#/components/schemas/DeploymentGatesFDDRuleType"
required:
- type
- name
type: object
DeploymentGatesFDDRuleOptions:
description: Options for a `faulty_deployment_detection` rule.
properties:
duration:
description: Evaluation window in seconds. Maximum 7200 (2 hours).
example: 900
format: int64
maximum: 7200
type: integer
excluded_resources:
description: APM resource names to exclude from analysis.
example:
- "GET /healthcheck"
items:
type: string
type: array
type: object
DeploymentGatesFDDRuleType:
description: The type identifier for a faulty deployment detection rule.
enum:
- faulty_deployment_detection
example: faulty_deployment_detection
type: string
x-enum-varnames:
- FAULTY_DEPLOYMENT_DETECTION
DeploymentGatesListResponse:
description: Response containing a paginated list of deployment gates.
properties:
Expand Down Expand Up @@ -29596,6 +29674,49 @@ components:
minimum: 1
type: integer
type: object
DeploymentGatesMonitorRule:
description: A monitor rule to evaluate as part of a deployment gate evaluation.
properties:
dry_run:
description: Rule-level dry run. When enabled, the rule is evaluated normally but it always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
name:
description: Human-readable name for this rule.
example: "error rate monitors"
type: string
options:
$ref: "#/components/schemas/DeploymentGatesMonitorRuleOptions"
type:
$ref: "#/components/schemas/DeploymentGatesMonitorRuleType"
required:
- type
- name
type: object
DeploymentGatesMonitorRuleOptions:
description: Options for a `monitor` rule.
properties:
duration:
description: Evaluation window in seconds. Maximum 7200 (2 hours).
example: 300
format: int64
maximum: 7200
type: integer
query:
description: Monitor search query.
example: "service:transaction-backend env:production"
type: string
required:
- query
type: object
DeploymentGatesMonitorRuleType:
description: The type identifier for a monitor rule.
enum:
- monitor
example: monitor
type: string
x-enum-varnames:
- MONITOR
DeploymentGatesRuleResponse:
description: The result of a single rule evaluation.
properties:
Expand Down Expand Up @@ -121740,12 +121861,17 @@ paths:
Triggers an asynchronous deployment gate evaluation for the given service and environment.
Returns an evaluation ID that can be used to poll for the result via the
`GET /api/v2/deployments/gates/evaluation/{id}` endpoint.

When the `configuration` attribute is provided, rules are evaluated inline from that configuration
and no pre-configured gate is required. When `configuration` is omitted, rules are resolved from the
gate pre-configured for the given service and environment via the Datadog UI, API, or Terraform.
operationId: TriggerDeploymentGatesEvaluation
requestBody:
content:
application/json:
examples:
default:
summary: Evaluate a pre-configured gate
value:
data:
attributes:
Expand All @@ -121755,6 +121881,31 @@ paths:
service: transaction-backend
version: v1.2.3
type: deployment_gates_evaluation_request
with-configuration:
summary: Evaluate with inline rule configuration
value:
data:
attributes:
configuration:
dry_run: false
rules:
- dry_run: false
name: error rate monitors
options:
duration: 300
query: "service:transaction-backend env:production"
type: monitor
- dry_run: false
name: apm faulty deployment
options:
duration: 900
excluded_resources:
- "GET /healthcheck"
type: faulty_deployment_detection
env: production
service: transaction-backend
version: 1.2.3
type: deployment_gates_evaluation_request
schema:
$ref: "#/components/schemas/DeploymentGatesEvaluationRequest"
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
body = DatadogAPIClient::V2::DeploymentGatesEvaluationRequest.new({
data: DatadogAPIClient::V2::DeploymentGatesEvaluationRequestData.new({
attributes: DatadogAPIClient::V2::DeploymentGatesEvaluationRequestAttributes.new({
configuration: DatadogAPIClient::V2::DeploymentGatesEvaluationConfiguration.new({
dry_run: false,
rules: [
DatadogAPIClient::V2::DeploymentGatesMonitorRule.new({
dry_run: false,
name: "error rate monitors",
options: DatadogAPIClient::V2::DeploymentGatesMonitorRuleOptions.new({
duration: 300,
query: "service:transaction-backend env:production",
}),
type: DatadogAPIClient::V2::DeploymentGatesMonitorRuleType::MONITOR,
}),
],
}),
env: "staging",
identifier: "pre-deploy",
primary_tag: "region:us-east-1",
Expand Down
6 changes: 3 additions & 3 deletions features/v2/deployment_gates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,23 @@ Feature: Deployment Gates
Scenario: Trigger a deployment gate evaluation returns "Accepted" response
Given operation "TriggerDeploymentGatesEvaluation" enabled
And new "TriggerDeploymentGatesEvaluation" request
And body with value {"data": {"attributes": {"env": "staging", "identifier": "pre-deploy", "primary_tag": "region:us-east-1", "service": "transaction-backend", "version": "v1.2.3"}, "type": "deployment_gates_evaluation_request"}}
And body with value {"data": {"attributes": {"configuration": {"dry_run": false, "rules": [{"dry_run": false, "name": "error rate monitors", "options": {"duration": 300, "query": "service:transaction-backend env:production"}, "type": "monitor"}]}, "env": "staging", "identifier": "pre-deploy", "primary_tag": "region:us-east-1", "service": "transaction-backend", "version": "v1.2.3"}, "type": "deployment_gates_evaluation_request"}}
When the request is sent
Then the response status is 202 Accepted

@generated @skip @team:DataDog/ci-app-backend
Scenario: Trigger a deployment gate evaluation returns "Bad request." response
Given operation "TriggerDeploymentGatesEvaluation" enabled
And new "TriggerDeploymentGatesEvaluation" request
And body with value {"data": {"attributes": {"env": "staging", "identifier": "pre-deploy", "primary_tag": "region:us-east-1", "service": "transaction-backend", "version": "v1.2.3"}, "type": "deployment_gates_evaluation_request"}}
And body with value {"data": {"attributes": {"configuration": {"dry_run": false, "rules": [{"dry_run": false, "name": "error rate monitors", "options": {"duration": 300, "query": "service:transaction-backend env:production"}, "type": "monitor"}]}, "env": "staging", "identifier": "pre-deploy", "primary_tag": "region:us-east-1", "service": "transaction-backend", "version": "v1.2.3"}, "type": "deployment_gates_evaluation_request"}}
When the request is sent
Then the response status is 400 Bad request.

@generated @skip @team:DataDog/ci-app-backend
Scenario: Trigger a deployment gate evaluation returns "Deployment gate not found." response
Given operation "TriggerDeploymentGatesEvaluation" enabled
And new "TriggerDeploymentGatesEvaluation" request
And body with value {"data": {"attributes": {"env": "staging", "identifier": "pre-deploy", "primary_tag": "region:us-east-1", "service": "transaction-backend", "version": "v1.2.3"}, "type": "deployment_gates_evaluation_request"}}
And body with value {"data": {"attributes": {"configuration": {"dry_run": false, "rules": [{"dry_run": false, "name": "error rate monitors", "options": {"duration": 300, "query": "service:transaction-backend env:production"}, "type": "monitor"}]}, "env": "staging", "identifier": "pre-deploy", "primary_tag": "region:us-east-1", "service": "transaction-backend", "version": "v1.2.3"}, "type": "deployment_gates_evaluation_request"}}
When the request is sent
Then the response status is 404 Deployment gate not found.

Expand Down
8 changes: 8 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,7 @@ def overrides
"v2.deployment_gate_response_data_attributes_created_by" => "DeploymentGateResponseDataAttributesCreatedBy",
"v2.deployment_gate_response_data_attributes_updated_by" => "DeploymentGateResponseDataAttributesUpdatedBy",
"v2.deployment_gate_rules_response" => "DeploymentGateRulesResponse",
"v2.deployment_gates_evaluation_configuration" => "DeploymentGatesEvaluationConfiguration",
"v2.deployment_gates_evaluation_request" => "DeploymentGatesEvaluationRequest",
"v2.deployment_gates_evaluation_request_attributes" => "DeploymentGatesEvaluationRequestAttributes",
"v2.deployment_gates_evaluation_request_data" => "DeploymentGatesEvaluationRequestData",
Expand All @@ -2769,9 +2770,16 @@ def overrides
"v2.deployment_gates_evaluation_result_response_attributes_gate_status" => "DeploymentGatesEvaluationResultResponseAttributesGateStatus",
"v2.deployment_gates_evaluation_result_response_data" => "DeploymentGatesEvaluationResultResponseData",
"v2.deployment_gates_evaluation_result_response_data_type" => "DeploymentGatesEvaluationResultResponseDataType",
"v2.deployment_gates_evaluation_rule" => "DeploymentGatesEvaluationRule",
"v2.deployment_gates_fdd_rule" => "DeploymentGatesFDDRule",
"v2.deployment_gates_fdd_rule_options" => "DeploymentGatesFDDRuleOptions",
"v2.deployment_gates_fdd_rule_type" => "DeploymentGatesFDDRuleType",
"v2.deployment_gates_list_response" => "DeploymentGatesListResponse",
"v2.deployment_gates_list_response_meta" => "DeploymentGatesListResponseMeta",
"v2.deployment_gates_list_response_meta_page" => "DeploymentGatesListResponseMetaPage",
"v2.deployment_gates_monitor_rule" => "DeploymentGatesMonitorRule",
"v2.deployment_gates_monitor_rule_options" => "DeploymentGatesMonitorRuleOptions",
"v2.deployment_gates_monitor_rule_type" => "DeploymentGatesMonitorRuleType",
"v2.deployment_gates_rule_response" => "DeploymentGatesRuleResponse",
"v2.deployment_metadata" => "DeploymentMetadata",
"v2.deployment_relationship" => "DeploymentRelationship",
Expand Down
4 changes: 4 additions & 0 deletions lib/datadog_api_client/v2/api/deployment_gates_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ def trigger_deployment_gates_evaluation(body, opts = {})
# Returns an evaluation ID that can be used to poll for the result via the
# `GET /api/v2/deployments/gates/evaluation/{id}` endpoint.
#
# When the `configuration` attribute is provided, rules are evaluated inline from that configuration
# and no pre-configured gate is required. When `configuration` is omitted, rules are resolved from the
# gate pre-configured for the given service and environment via the Datadog UI, API, or Terraform.
#
# @param body [DeploymentGatesEvaluationRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(DeploymentGatesEvaluationResponse, Integer, Hash)>] DeploymentGatesEvaluationResponse data, response status code and response headers
Expand Down
Loading
Loading