Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Beta Banner to Send Pipeline Events Endpoint #1390

Merged
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-27 07:36:51.319505",
"spec_repo_commit": "2204d6df"
"regenerated": "2023-10-27 08:09:52.751716",
"spec_repo_commit": "86d56f2b"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2023-10-27 07:36:51.339307",
"spec_repo_commit": "2204d6df"
"regenerated": "2023-10-27 08:09:52.780380",
"spec_repo_commit": "86d56f2b"
}
}
}
3 changes: 3 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
@@ -19705,6 +19705,9 @@ paths:
tags:
- CI Visibility Pipelines
x-codegen-request-body-name: body
x-unstable: '**Note:** This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/ci/pipelines/analytics/aggregate:
post:
description: Use this API endpoint to aggregate CI Visibility pipeline events
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createCIAppPipelineEvent"] = true;
const apiInstance = new v2.CIVisibilityPipelinesApi(configuration);

const params: v2.CIVisibilityPipelinesApiCreateCIAppPipelineEventRequest = {
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createCIAppPipelineEvent"] = true;
const apiInstance = new v2.CIVisibilityPipelinesApi(configuration);

const params: v2.CIVisibilityPipelinesApiCreateCIAppPipelineEventRequest = {
15 changes: 10 additions & 5 deletions features/v2/ci_visibility_pipelines.feature
Original file line number Diff line number Diff line change
@@ -80,35 +80,40 @@ Feature: CI Visibility Pipelines

@generated @skip @team:Datadog/ci-app-backend @team:Datadog/integrations-tools-and-libraries
Scenario: Send pipeline event returns "Bad Request" response
Given new "CreateCIAppPipelineEvent" request
Given operation "CreateCIAppPipelineEvent" enabled
And new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": "Details TBD"}, "type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:Datadog/ci-app-backend @team:Datadog/integrations-tools-and-libraries
Scenario: Send pipeline event returns "Payload Too Large" response
Given new "CreateCIAppPipelineEvent" request
Given operation "CreateCIAppPipelineEvent" enabled
And new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": "Details TBD"}, "type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 413 Payload Too Large

@generated @skip @team:Datadog/ci-app-backend @team:Datadog/integrations-tools-and-libraries
Scenario: Send pipeline event returns "Request Timeout" response
Given new "CreateCIAppPipelineEvent" request
Given operation "CreateCIAppPipelineEvent" enabled
And new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": "Details TBD"}, "type": "cipipeline_resource_request"}}
When the request is sent
Then the response status is 408 Request Timeout

@team:Datadog/ci-app-backend @team:Datadog/integrations-tools-and-libraries
Scenario: Send pipeline event returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
Given operation "CreateCIAppPipelineEvent" enabled
And new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": {"end": "{{ timeISO('now - 30s') }}", "level": "pipeline", "name": "Deploy to AWS", "partial_retry": false, "start": "{{ timeISO('now - 120s') }}", "status": "success", "unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "url": "https://my-ci-provider.example/pipelines/my-pipeline/run/1","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 @team:Datadog/integrations-tools-and-libraries
Scenario: Send pipeline job event returns "Request accepted for processing" response
Given new "CreateCIAppPipelineEvent" request
Given operation "CreateCIAppPipelineEvent" enabled
And new "CreateCIAppPipelineEvent" request
And body with value {"data": {"attributes": {"resource": {"end": "{{ timeISO('now - 30s') }}", "level": "job", "name": "Build image", "start": "{{ timeISO('now - 120s') }}", "status": "error", "id": "cf9456de-8b9e-4c27-aa79-27b1e78c1a33", "pipeline_unique_id": "3eacb6f3-ff04-4e10-8a9c-46e6d054024a", "pipeline_name": "Deploy to AWS", "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
1 change: 1 addition & 0 deletions packages/datadog-api-client-common/configuration.ts
Original file line number Diff line number Diff line change
@@ -214,6 +214,7 @@ export function createConfiguration(
conf.backoffBase || 2,
conf.backoffMultiplier || 2,
{
"v2.createCIAppPipelineEvent": false,
"v2.listContainerImages": false,
"v2.listContainers": false,
"v2.listEvents": false,
Original file line number Diff line number Diff line change
@@ -76,6 +76,13 @@ export class CIVisibilityPipelinesApiRequestFactory extends BaseAPIRequestFactor
): Promise<RequestContext> {
const _config = _options || this.configuration;

logger.warn("Using unstable operation 'createCIAppPipelineEvent'");
if (!_config.unstableOperations["v2.createCIAppPipelineEvent"]) {
throw new Error(
"Unstable operation 'createCIAppPipelineEvent' is disabled"
);
}

// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError("body", "createCIAppPipelineEvent");