Skip to content
Merged
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
15 changes: 14 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5994,7 +5994,7 @@ components:
description: Request object.
properties:
data:
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestData'
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataSingleOrArray'
type: object
CIAppCreatePipelineEventRequestAttributes:
description: Attributes of the pipeline event to create.
Expand Down Expand Up @@ -6030,6 +6030,16 @@ components:
type:
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataType'
type: object
CIAppCreatePipelineEventRequestDataArray:
description: Array of pipeline events to create in batch.
items:
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestData'
type: array
CIAppCreatePipelineEventRequestDataSingleOrArray:
description: Data of the pipeline events to create.
oneOf:
- $ref: '#/components/schemas/CIAppCreatePipelineEventRequestData'
- $ref: '#/components/schemas/CIAppCreatePipelineEventRequestDataArray'
CIAppCreatePipelineEventRequestDataType:
default: cipipeline_resource_request
description: Type of the event.
Expand Down Expand Up @@ -51718,6 +51728,9 @@ paths:
we support, see [Pipeline Data Model And Execution Types](https://docs.datadoghq.com/continuous_integration/guides/pipeline_data_model/).


Multiple events can be sent in an array (up to 1000).


Pipeline events can be submitted with a timestamp that is up to 18 hours in
the past.'
operationId: CreateCIAppPipelineEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-09-02T15:10:26.479Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Send several pipeline events returns "Request accepted for processing" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::CIVisibilityPipelinesAPI.new

body = DatadogAPIClient::V2::CIAppCreatePipelineEventRequest.new({
data: [
DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({
attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({
provider_name: "example-provider",
resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({
level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE,
unique_id: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
name: "Deploy to AWS",
url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1",
start: (Time.now + -120),
_end: (Time.now + -30),
status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS,
partial_retry: false,
git: DatadogAPIClient::V2::CIAppGitInfo.new({
repository_url: "https://github.com/DataDog/datadog-agent",
sha: "7f263865994b76066c4612fd1965215e7dcb4cd2",
author_email: "john.doe@email.com",
}),
}),
}),
type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST,
}),
DatadogAPIClient::V2::CIAppCreatePipelineEventRequestData.new({
attributes: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestAttributes.new({
provider_name: "example-provider",
resource: DatadogAPIClient::V2::CIAppPipelineEventFinishedPipeline.new({
level: DatadogAPIClient::V2::CIAppPipelineEventPipelineLevel::PIPELINE,
unique_id: "7b2c8f9e-aa15-4d22-9c7d-83f4e065138b",
name: "Deploy to Production",
url: "https://my-ci-provider.example/pipelines/prod-pipeline/run/2",
start: (Time.now + -180),
_end: (Time.now + -45),
status: DatadogAPIClient::V2::CIAppPipelineEventPipelineStatus::SUCCESS,
partial_retry: false,
git: DatadogAPIClient::V2::CIAppGitInfo.new({
repository_url: "https://github.com/DataDog/datadog-agent",
sha: "9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e",
author_email: "jane.smith@email.com",
}),
}),
}),
type: DatadogAPIClient::V2::CIAppCreatePipelineEventRequestDataType::CIPIPELINE_RESOURCE_REQUEST,
}),
],
})
p api_instance.create_ci_app_pipeline_event(body)
25 changes: 16 additions & 9 deletions features/v2/ci_visibility_pipelines.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: CI Visibility Pipelines
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/ci-app-backend
@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Aggregate pipelines events returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "AggregateCIAppPipelineEvents" request
Expand All @@ -33,7 +33,7 @@ Feature: CI Visibility Pipelines
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/ci-app-backend
@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Get a list of pipelines events returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "ListCIAppPipelineEvents" request
Expand All @@ -44,7 +44,7 @@ Feature: CI Visibility Pipelines
When the request is sent
Then the response status is 200 OK

@replay-only @skip-validation @team:DataDog/ci-app-backend @with-pagination
@replay-only @skip-java @skip-python @skip-typescript @skip-validation @team:DataDog/ci-app-backend @with-pagination
Scenario: Get a list of pipelines events returns "OK" response with pagination
Given a valid "appKeyAuth" key in the system
And new "ListCIAppPipelineEvents" request
Expand All @@ -63,15 +63,15 @@ Feature: CI Visibility Pipelines
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/ci-app-backend
@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Search pipelines events returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "SearchCIAppPipelineEvents" request
And body with value {"filter": {"from": "now-15m", "query": "@ci.provider.name:github AND @ci.status:error", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"limit": 5}, "sort": "timestamp"}
When the request is sent
Then the response status is 200 OK

@replay-only @skip-validation @team:DataDog/ci-app-backend @with-pagination
@replay-only @skip-java @skip-python @skip-typescript @skip-validation @team:DataDog/ci-app-backend @with-pagination
Scenario: Search pipelines events returns "OK" response with pagination
Given a valid "appKeyAuth" key in the system
And new "SearchCIAppPipelineEvents" request
Expand Down Expand Up @@ -101,30 +101,37 @@ Feature: CI Visibility Pipelines
When the request is sent
Then the response status is 408 Request Timeout

@team:DataDog/ci-app-backend
@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Send pipeline event returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 202 Request accepted for processing

@team:DataDog/ci-app-backend
@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Send pipeline event with custom provider returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 202 Request accepted for processing

@skip @team:DataDog/ci-app-backend
@skip @skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Send pipeline job event returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": {"level": "job", "id": "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", "name": "Build image", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "pipeline_name": "Deploy to AWS", "start": "{{ timeISO('now - 120s') }}", "end": "{{ timeISO('now - 30s') }}", "status": "error", "url": "https://my-ci-provider.example/jobs/my-jobs/run/1"}}, "type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 202 Request accepted for processing

@team:DataDog/ci-app-backend
@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Send running pipeline event returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","status": "running","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 202 Request accepted for processing

@skip-java @skip-python @skip-typescript @team:DataDog/ci-app-backend
Scenario: Send several pipeline events returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
And body with value {"data": [{"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a","name": "Deploy to AWS","url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","start": "{{ timeISO('now - 120s') }}","end": "{{ timeISO('now - 30s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "7f263865994b76066c4612fd1965215e7dcb4cd2","author_email": "john.doe@email.com"}}},"type": "cipipeline_resource_request"},{"attributes": {"provider_name": "example-provider", "resource": {"level": "pipeline","unique_id": "7b2c8f9e-aa15-4d22-9c7d-83f4e065138b","name": "Deploy to Production","url": "https://my-ci-provider.example/pipelines/prod-pipeline/run/2","start": "{{ timeISO('now - 180s') }}","end": "{{ timeISO('now - 45s') }}","status": "success","partial_retry": false,"git": {"repository_url": "https://github.com/DataDog/datadog-agent","sha": "9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e","author_email": "jane.smith@email.com"}}},"type": "cipipeline_resource_request"}]}
When the request is sent
Then the response status is 202 Request accepted for processing
1 change: 1 addition & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1324,6 +1324,7 @@ def overrides
"v2.ci_app_create_pipeline_event_request_attributes" => "CIAppCreatePipelineEventRequestAttributes",
"v2.ci_app_create_pipeline_event_request_attributes_resource" => "CIAppCreatePipelineEventRequestAttributesResource",
"v2.ci_app_create_pipeline_event_request_data" => "CIAppCreatePipelineEventRequestData",
"v2.ci_app_create_pipeline_event_request_data_single_or_array" => "CIAppCreatePipelineEventRequestDataSingleOrArray",
"v2.ci_app_create_pipeline_event_request_data_type" => "CIAppCreatePipelineEventRequestDataType",
"v2.ci_app_event_attributes" => "CIAppEventAttributes",
"v2.ci_app_git_info" => "CIAppGitInfo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def create_ci_app_pipeline_event(body, opts = {})
#
# Send your pipeline event to your Datadog platform over HTTP. For details about how pipeline executions are modeled and what execution types we support, see [Pipeline Data Model And Execution Types](https://docs.datadoghq.com/continuous_integration/guides/pipeline_data_model/).
#
# Multiple events can be sent in an array (up to 1000).
#
# Pipeline events can be submitted with a timestamp that is up to 18 hours in the past.
#
# @param body [CIAppCreatePipelineEventRequest]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module DatadogAPIClient::V2
class CIAppCreatePipelineEventRequest
include BaseGenericModel

# Data of the pipeline event to create.
# Data of the pipeline events to create.
attr_accessor :data

attr_accessor :additional_properties
Expand All @@ -38,7 +38,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'data' => :'CIAppCreatePipelineEventRequestData'
:'data' => :'CIAppCreatePipelineEventRequestDataSingleOrArray'
}
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
=begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product includes software developed at Datadog (https://www.datadoghq.com/).
Copyright 2020-Present Datadog, Inc.
=end

require 'date'
require 'time'

module DatadogAPIClient::V2
# Data of the pipeline events to create.
module CIAppCreatePipelineEventRequestDataSingleOrArray
class << self
include BaseOneOfModel
include BaseOneOfModelNoDiscriminator

# List of class defined in oneOf (OpenAPI v3)
def openapi_one_of
[
:'CIAppCreatePipelineEventRequestData',
:'Array<CIAppCreatePipelineEventRequestData>'
]
end
# Builds the object
# @param data [Mixed] Data to be matched against the list of oneOf items
# @return [Object] Returns the model or the data itself
def build(data)
# Go through the list of oneOf items and attempt to identify the appropriate one.
# Note:
# - We do not attempt to check whether exactly one item matches.
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
# - TODO: scalar values are de facto behaving as if they were nullable.
# - TODO: logging when debugging is set.
openapi_one_of.each do |klass|
begin
next if klass == :AnyType # "nullable: true"
typed_data = find_and_cast_into_type(klass, data)
next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed
return typed_data if typed_data
rescue # rescue all errors so we keep iterating even if the current item lookup raises
end
end

if openapi_one_of.include?(:AnyType)
data
else
self._unparsed = true
DatadogAPIClient::UnparsedObject.new(data)
end
end
end
end
end
Loading