Skip to content

Commit 16941f3

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add provider_name attribute to pipelines API (#1986)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent cf15a03 commit 16941f3

File tree

7 files changed

+133
-4
lines changed

7 files changed

+133
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-01-17 21:41:11.567854",
8-
"spec_repo_commit": "27e609f7"
7+
"regenerated": "2025-01-21 14:16:28.842409",
8+
"spec_repo_commit": "0bbc13ae"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-17 21:41:11.583353",
13-
"spec_repo_commit": "27e609f7"
12+
"regenerated": "2025-01-21 14:16:28.858914",
13+
"spec_repo_commit": "0bbc13ae"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3552,6 +3552,9 @@ components:
35523552
env:
35533553
description: The Datadog environment.
35543554
type: string
3555+
provider_name:
3556+
description: The name of the CI provider. By default, this is "custom".
3557+
type: string
35553558
resource:
35563559
$ref: '#/components/schemas/CIAppCreatePipelineEventRequestAttributesResource'
35573560
service:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2025-01-08T08:57:29.599Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"log": {
3+
"_recordingName": "CI Visibility Pipelines/Send pipeline event with custom provider returns \"Request accepted for processing\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "c3f1f2457eca522f3006d46cf4c7d02e",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 532,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 508,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"provider_name\":\"example-provider\",\"resource\":{\"end\":\"2025-01-08T08:56:59.599Z\",\"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-01-08T08:55:29.599Z\",\"status\":\"success\",\"unique_id\":\"3eacb6f3-ff04-4e10-8a9c-46e6d054024a\",\"url\":\"https://my-ci-provider.example/pipelines/my-pipeline/run/1\"}},\"type\":\"cipipeline_resource_request\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/ci/pipeline"
39+
},
40+
"response": {
41+
"bodySize": 13,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 13,
45+
"text": "{\"data\":null}"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 676,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 202,
58+
"statusText": "Accepted"
59+
},
60+
"startedDateTime": "2025-01-08T08:57:29.994Z",
61+
"time": 254
62+
}
63+
],
64+
"pages": [],
65+
"version": "1.2"
66+
}
67+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Send pipeline event with custom provider returns "Request accepted for processing" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.CIVisibilityPipelinesApi(configuration);
9+
10+
const params: v2.CIVisibilityPipelinesApiCreateCIAppPipelineEventRequest = {
11+
body: {
12+
data: {
13+
attributes: {
14+
providerName: "example-provider",
15+
resource: {
16+
level: "pipeline",
17+
uniqueId: "3eacb6f3-ff04-4e10-8a9c-46e6d054024a",
18+
name: "Deploy to AWS",
19+
url: "https://my-ci-provider.example/pipelines/my-pipeline/run/1",
20+
start: new Date(new Date().getTime() + -120 * 1000),
21+
end: new Date(new Date().getTime() + -30 * 1000),
22+
status: "success",
23+
partialRetry: false,
24+
git: {
25+
repositoryUrl: "https://github.com/DataDog/datadog-agent",
26+
sha: "7f263865994b76066c4612fd1965215e7dcb4cd2",
27+
authorEmail: "[email protected]",
28+
},
29+
},
30+
},
31+
type: "cipipeline_resource_request",
32+
},
33+
},
34+
};
35+
36+
apiInstance
37+
.createCIAppPipelineEvent(params)
38+
.then((data: any) => {
39+
console.log(
40+
"API called successfully. Returned data: " + JSON.stringify(data)
41+
);
42+
})
43+
.catch((error: any) => console.error(error));

features/v2/ci_visibility_pipelines.feature

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ Feature: CI Visibility Pipelines
108108
When the request is sent
109109
Then the response status is 202 Request accepted for processing
110110

111+
@team:Datadog/ci-app-backend
112+
Scenario: Send pipeline event with custom provider returns "Request accepted for processing" response
113+
Given new "CreateCIAppPipelineEvent" request
114+
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"}}
115+
When the request is sent
116+
Then the response status is 202 Request accepted for processing
117+
111118
@skip @team:Datadog/ci-app-backend
112119
Scenario: Send pipeline job event returns "Request accepted for processing" response
113120
Given new "CreateCIAppPipelineEvent" request

packages/datadog-api-client-v2/models/CIAppCreatePipelineEventRequestAttributes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export class CIAppCreatePipelineEventRequestAttributes {
1515
* The Datadog environment.
1616
*/
1717
"env"?: string;
18+
/**
19+
* The name of the CI provider. By default, this is "custom".
20+
*/
21+
"providerName"?: string;
1822
/**
1923
* Details of the CI pipeline event.
2024
*/
@@ -44,6 +48,10 @@ export class CIAppCreatePipelineEventRequestAttributes {
4448
baseName: "env",
4549
type: "string",
4650
},
51+
providerName: {
52+
baseName: "provider_name",
53+
type: "string",
54+
},
4755
resource: {
4856
baseName: "resource",
4957
type: "CIAppCreatePipelineEventRequestAttributesResource",

0 commit comments

Comments
 (0)