-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
provider_name
attribute to pipelines API (#2345)
Co-authored-by: ci.datadog-api-spec <[email protected]>
- Loading branch information
1 parent
44a302a
commit e668aae
Showing
7 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
examples/v2/ci-visibility-pipelines/CreateCIAppPipelineEvent_819339921.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Send pipeline event with custom provider returns "Request accepted for processing" response | ||
""" | ||
|
||
from datetime import datetime | ||
from dateutil.relativedelta import relativedelta | ||
from datadog_api_client import ApiClient, Configuration | ||
from datadog_api_client.v2.api.ci_visibility_pipelines_api import CIVisibilityPipelinesApi | ||
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request import CIAppCreatePipelineEventRequest | ||
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_attributes import ( | ||
CIAppCreatePipelineEventRequestAttributes, | ||
) | ||
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data import CIAppCreatePipelineEventRequestData | ||
from datadog_api_client.v2.model.ci_app_create_pipeline_event_request_data_type import ( | ||
CIAppCreatePipelineEventRequestDataType, | ||
) | ||
from datadog_api_client.v2.model.ci_app_git_info import CIAppGitInfo | ||
from datadog_api_client.v2.model.ci_app_pipeline_event_finished_pipeline import CIAppPipelineEventFinishedPipeline | ||
from datadog_api_client.v2.model.ci_app_pipeline_event_pipeline_level import CIAppPipelineEventPipelineLevel | ||
from datadog_api_client.v2.model.ci_app_pipeline_event_pipeline_status import CIAppPipelineEventPipelineStatus | ||
|
||
body = CIAppCreatePipelineEventRequest( | ||
data=CIAppCreatePipelineEventRequestData( | ||
attributes=CIAppCreatePipelineEventRequestAttributes( | ||
provider_name="example-provider", | ||
resource=CIAppPipelineEventFinishedPipeline( | ||
level=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=(datetime.now() + relativedelta(seconds=-120)), | ||
end=(datetime.now() + relativedelta(seconds=-30)), | ||
status=CIAppPipelineEventPipelineStatus.SUCCESS, | ||
partial_retry=False, | ||
git=CIAppGitInfo( | ||
repository_url="https://github.com/DataDog/datadog-agent", | ||
sha="7f263865994b76066c4612fd1965215e7dcb4cd2", | ||
author_email="[email protected]", | ||
), | ||
), | ||
), | ||
type=CIAppCreatePipelineEventRequestDataType.CIPIPELINE_RESOURCE_REQUEST, | ||
), | ||
) | ||
|
||
configuration = Configuration() | ||
with ApiClient(configuration) as api_client: | ||
api_instance = CIVisibilityPipelinesApi(api_client) | ||
response = api_instance.create_ci_app_pipeline_event(body=body) | ||
|
||
print(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...peline_event_with_custom_provider_returns_request_accepted_for_processing_response.frozen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2025-01-08T08:57:29.599Z |
21 changes: 21 additions & 0 deletions
21
...pipeline_event_with_custom_provider_returns_request_accepted_for_processing_response.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
interactions: | ||
- request: | ||
body: '{"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"}}' | ||
headers: | ||
accept: | ||
- application/json | ||
content-type: | ||
- application/json | ||
method: POST | ||
uri: https://api.datadoghq.com/api/v2/ci/pipeline | ||
response: | ||
body: | ||
string: '{"data":null}' | ||
headers: | ||
content-type: | ||
- application/vnd.api+json | ||
status: | ||
code: 202 | ||
message: Accepted | ||
version: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,13 @@ Feature: CI Visibility Pipelines | |
When the request is sent | ||
Then the response status is 202 Request accepted for processing | ||
|
||
@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": "[email protected]"}}},"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 | ||
Scenario: Send pipeline job event returns "Request accepted for processing" response | ||
Given new "CreateCIAppPipelineEvent" request | ||
|