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
15 changes: 14 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5847,7 +5847,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 @@ -5883,6 +5883,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 @@ -49695,6 +49705,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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"log": {
"_recordingName": "CI Visibility Pipelines/Send several pipeline events returns \"Request accepted for processing\" response",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "072988315f64383f647bdf106bca8593",
"_order": 0,
"cache": {},
"request": {
"bodySize": 1069,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 509,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"data\":[{\"attributes\":{\"provider_name\":\"example-provider\",\"resource\":{\"end\":\"2025-09-02T15:09:56.479Z\",\"git\":{\"author_email\":\"[email protected]\",\"repository_url\":\"https://github.com/DataDog/datadog-agent\",\"sha\":\"7f263865994b76066c4612fd1965215e7dcb4cd2\"},\"level\":\"pipeline\",\"name\":\"Deploy to AWS\",\"partial_retry\":false,\"start\":\"2025-09-02T15:08:26.479Z\",\"status\":\"success\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"},{\"attributes\":{\"provider_name\":\"example-provider\",\"resource\":{\"end\":\"2025-09-02T15:09:41.479Z\",\"git\":{\"author_email\":\"[email protected]\",\"repository_url\":\"https://github.com/DataDog/datadog-agent\",\"sha\":\"9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e\"},\"level\":\"pipeline\",\"name\":\"Deploy to Production\",\"partial_retry\":false,\"start\":\"2025-09-02T15:07:26.479Z\",\"status\":\"success\",\"unique_id\":\"7b2c8f9e-aa15-4d22-9c7d-83f4e065138b\",\"url\":\"https://my-ci-provider.example/pipelines/prod-pipeline/run/2\"}},\"type\":\"cipipeline_resource_request\"}]}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v2/ci/pipeline"
},
"response": {
"bodySize": 13,
"content": {
"mimeType": "application/vnd.api+json",
"size": 13,
"text": "{\"data\":null}"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/vnd.api+json"
}
],
"headersSize": 676,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 202,
"statusText": "Accepted"
},
"startedDateTime": "2025-09-02T15:10:26.749Z",
"time": 396
}
],
"pages": [],
"version": "1.2"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Send several pipeline events returns "Request accepted for processing" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.CIVisibilityPipelinesApi(configuration);

const params: v2.CIVisibilityPipelinesApiCreateCIAppPipelineEventRequest = {
body: {
data: [
{
attributes: {
providerName: "example-provider",
resource: {
level: "pipeline",
uniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
name: "Deploy to AWS",
url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1",
start: new Date(new Date().getTime() + -120 * 1000),
end: new Date(new Date().getTime() + -30 * 1000),
status: "success",
partialRetry: false,
git: {
repositoryUrl: "https://github.com/DataDog/datadog-agent",
sha: "7f263865994b76066c4612fd1965215e7dcb4cd2",
authorEmail: "[email protected]",
},
},
},
type: "cipipeline_resource_request",
},
{
attributes: {
providerName: "example-provider",
resource: {
level: "pipeline",
uniqueId: "7b2c8f9e-aa15-4d22-9c7d-83f4e065138b",
name: "Deploy to Production",
url: "https://my-ci-provider.example/pipelines/prod-pipeline/run/2",
start: new Date(new Date().getTime() + -180 * 1000),
end: new Date(new Date().getTime() + -45 * 1000),
status: "success",
partialRetry: false,
git: {
repositoryUrl: "https://github.com/DataDog/datadog-agent",
sha: "9a4f7c28b3e5d12f8e6c9b2a5d8f3e1c7b4a6d9e",
authorEmail: "[email protected]",
},
},
},
type: "cipipeline_resource_request",
},
],
},
};

apiInstance
.createCIAppPipelineEvent(params)
.then((data: any) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
7 changes: 7 additions & 0 deletions features/v2/ci_visibility_pipelines.feature
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,10 @@ Feature: CI Visibility Pipelines
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": "[email protected]"}}},"type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 202 Request accepted for processing

@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": "[email protected]"}}},"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": "[email protected]"}}},"type": "cipipeline_resource_request"}]}
When the request is sent
Then the response status is 202 Request accepted for processing
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ export class CIVisibilityPipelinesApi {
/**
* 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 param The request object
*/
Expand Down
1 change: 1 addition & 0 deletions packages/datadog-api-client-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ export { CIAppCreatePipelineEventRequest } from "./models/CIAppCreatePipelineEve
export { CIAppCreatePipelineEventRequestAttributes } from "./models/CIAppCreatePipelineEventRequestAttributes";
export { CIAppCreatePipelineEventRequestAttributesResource } from "./models/CIAppCreatePipelineEventRequestAttributesResource";
export { CIAppCreatePipelineEventRequestData } from "./models/CIAppCreatePipelineEventRequestData";
export { CIAppCreatePipelineEventRequestDataSingleOrArray } from "./models/CIAppCreatePipelineEventRequestDataSingleOrArray";
export { CIAppCreatePipelineEventRequestDataType } from "./models/CIAppCreatePipelineEventRequestDataType";
export { CIAppEventAttributes } from "./models/CIAppEventAttributes";
export { CIAppGitInfo } from "./models/CIAppGitInfo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2020-Present Datadog, Inc.
*/
import { CIAppCreatePipelineEventRequestData } from "./CIAppCreatePipelineEventRequestData";
import { CIAppCreatePipelineEventRequestDataSingleOrArray } from "./CIAppCreatePipelineEventRequestDataSingleOrArray";

import { AttributeTypeMap } from "../../datadog-api-client-common/util";

Expand All @@ -12,9 +12,9 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util";
*/
export class CIAppCreatePipelineEventRequest {
/**
* Data of the pipeline event to create.
* Data of the pipeline events to create.
*/
"data"?: CIAppCreatePipelineEventRequestData;
"data"?: CIAppCreatePipelineEventRequestDataSingleOrArray;

/**
* A container for additional, undeclared properties.
Expand All @@ -34,7 +34,7 @@ export class CIAppCreatePipelineEventRequest {
static readonly attributeTypeMap: AttributeTypeMap = {
data: {
baseName: "data",
type: "CIAppCreatePipelineEventRequestData",
type: "CIAppCreatePipelineEventRequestDataSingleOrArray",
},
additionalProperties: {
baseName: "additionalProperties",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* 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.
*/
import { CIAppCreatePipelineEventRequestData } from "./CIAppCreatePipelineEventRequestData";

import { UnparsedObject } from "../../datadog-api-client-common/util";

/**
* Data of the pipeline events to create.
*/

export type CIAppCreatePipelineEventRequestDataSingleOrArray =
| CIAppCreatePipelineEventRequestData
| Array<CIAppCreatePipelineEventRequestData>
| UnparsedObject;
4 changes: 4 additions & 0 deletions packages/datadog-api-client-v2/models/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6234,6 +6234,10 @@ const oneOfMap: { [index: string]: string[] } = {
"CIAppPipelineEventJob",
"CIAppPipelineEventStep",
],
CIAppCreatePipelineEventRequestDataSingleOrArray: [
"CIAppCreatePipelineEventRequestData",
"Array<CIAppCreatePipelineEventRequestData>",
],
CIAppGroupByMissing: ["string", "number"],
CIAppGroupByTotal: ["boolean", "string", "number"],
CIAppPipelineEventPipeline: [
Expand Down
Loading