-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Emre Dogan
committed
Feb 18, 2025
1 parent
4dacacf
commit 3f9ed9e
Showing
4 changed files
with
88 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,55 +5,95 @@ | |
"schemaVersion": 3, | ||
"type": "STANDARD", | ||
"trigger": { | ||
"eventTrigger": { | ||
"schedule": { | ||
"isActive": true, | ||
"filterQuery": "event.type == \"usecase.validation.trigger\"", | ||
"uniqueExpression": null, | ||
"triggerConfiguration": { | ||
"type": "event", | ||
"value": { | ||
"query": "event.type == \"usecase.validation.trigger\"", | ||
"eventType": "bizevents" | ||
} | ||
} | ||
"isFaulty": false, | ||
"trigger": { | ||
"type": "interval", | ||
"intervalMinutes": 240 | ||
}, | ||
"filterParameters": { | ||
"count": 20 | ||
}, | ||
"timezone": "Europe/Madrid", | ||
"inputs": {} | ||
} | ||
}, | ||
"tasks": { | ||
"get_pipeline_status": { | ||
"name": "get_pipeline_status", | ||
"action": "dynatrace.gitlab.connector:gitlab-get-pipeline-status", | ||
"description": "Get pipeline status using pipeline id from previous action output", | ||
"trigger_pipeline": { | ||
"name": "trigger_pipeline", | ||
"input": { | ||
"branchId": "main", | ||
"projectId": "1", | ||
"connection": "{{ .gitlab_connection_id }}", | ||
"pipelineId": "1" | ||
"variables": [], | ||
"connection": "{{ .gitlab_connection_id }}" | ||
}, | ||
"action": "dynatrace.gitlab.connector:gitlab-trigger-pipeline", | ||
"position": { | ||
"x": 0, | ||
"y": 1 | ||
}, | ||
"description": "Trigger a GitLab pipeline", | ||
"predecessors": [] | ||
}, | ||
"send_result_bizevent": { | ||
"name": "send_result_bizevent", | ||
"action": "dynatrace.automations:run-javascript", | ||
"description": "Build a custom task running js Code", | ||
"get_pipeline_status": { | ||
"name": "get_pipeline_status", | ||
"input": { | ||
"script": "import { businessEventsClient } from \"@dynatrace-sdk/client-classic-environment-v2\";\n// optional import of sdk modules\nimport { execution } from '@dynatrace-sdk/automation-utils';\n\nexport default async function ({ execution_id }) {\n // your code goes here\n // e.g. get the current execution\n const ex = await execution(execution_id);\n console.log('Automated script execution on behalf of', ex.trigger);\n\n // get the result of task 'my_task'. 'my_task' must be a predecessor.\n var myResult = await ex.result('get_pipeline_status');\n\n // log the result object\n console.log('The whole result object: ', myResult);\n console.log('only one variable: ', myResult.pipeline.status)\n \n const data = await businessEventsClient.ingest({\n type: \"application/cloudevent+json\",\n body: {\n specversion: \"1.0\",\n id: \"1\",\n source: \"custom.source\",\n type: \"usecase.validation.result\",\n component: \"gitlab\",\n result: myResult.pipeline.status,\n dataschema: \"http://dynatrace.com/schema/bizevents/generic/1.0\",\n },\n});\n \n return { triggeredBy: ex.trigger };\n}\n" | ||
"branchId": "main", | ||
"projectId": "1", | ||
"connection": "{{ .gitlab_connection_id }}", | ||
"pipelineId": "{{`{{`}} result(\"trigger_pipeline\").pipeline.id {{`}}`}}" | ||
}, | ||
"retry": { | ||
"count": 2, | ||
"delay": 30, | ||
"failedLoopIterationsOnly": true | ||
}, | ||
"action": "dynatrace.gitlab.connector:gitlab-get-pipeline-status", | ||
"position": { | ||
"x": 0, | ||
"y": 2 | ||
}, | ||
"conditions": { | ||
"states": { | ||
"trigger_pipeline": "OK" | ||
} | ||
}, | ||
"description": "Get pipeline status using pipeline id from previous action output", | ||
"waitBefore": 1200, | ||
"predecessors": [ | ||
"get_pipeline_status" | ||
], | ||
"trigger_pipeline" | ||
] | ||
}, | ||
"send_fail_email": { | ||
"name": "send_fail_email", | ||
"input": { | ||
"cc": [], | ||
"to": [ | ||
"[email protected]" | ||
], | ||
"bcc": [], | ||
"taskId": "{{ task().id }}", | ||
"content": "Pipeline Failed", | ||
"subject": "Pipeline Failed", | ||
"executionId": "{{ execution().id }}", | ||
"environmentUrl": "{{ environment().url }}" | ||
}, | ||
"action": "dynatrace.email:send-email", | ||
"position": { | ||
"x": 0, | ||
"y": 3 | ||
}, | ||
"conditions": { | ||
"custom": "{{`{{`}} result(\"get_pipeline_status\").pipeline.status != \"success\" {{`}}`}}", | ||
"states": { | ||
"get_pipeline_status": "OK" | ||
} | ||
} | ||
}, | ||
"description": "Send email", | ||
"predecessors": [ | ||
"get_pipeline_status" | ||
] | ||
} | ||
} | ||
|
||
|
6 changes: 6 additions & 0 deletions
6
...-release-validation-srg-gitlab/files/health-check/monaco/gitlab/outbound-connections.json
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,6 @@ | ||
{ | ||
"allowedOutboundConnections": { | ||
"enforced": true, | ||
"hostList": ["*.{{ .ingress_domain }}"] | ||
} | ||
} |
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