feat: get notified in Teams on E2E test failure ticket (#2021)

* init

* update

* can only include selected entity in request
This commit is contained in:
Adrian Stobbe 2023-07-05 15:37:38 +02:00 committed by GitHub
parent 38b7be4b1f
commit 3eecb5d7b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 2 deletions

View File

@ -88,7 +88,14 @@ runs:
if [[ -n "${{ inputs.refStream }}" ]]; then if [[ -n "${{ inputs.refStream }}" ]]; then
yq -iP '.attachments[0].content.body[0].columns[1].items[2].facts += [ { "title": "RefStream", "value": "${{ inputs.refStream }}" } ]' teams_payload.json yq -iP '.attachments[0].content.body[0].columns[1].items[2].facts += [ { "title": "RefStream", "value": "${{ inputs.refStream }}" } ]' teams_payload.json
fi fi
yq -iP '.attachments[0].content.body[0].columns[1].items[2].facts += [ { "title": "Assignee", "value": "${{ steps.pick-assignee.outputs.assignee }}" } ]' teams_payload.json text_value="<at>{{ steps.pick-assignee.outputs.assignee }}</at>"
entities=$(jq -c '.attachments[0].content.msteams.entities[]' teams_payload.json)
# need to filter entities to only have entry of mentioned person
filtered_entity=$(echo $entities | jq -r --arg text_value "$text_value" 'select(.text == $text_value)')
yq -iP '.attachments[0].content.msteams.entities = [ '"$filtered_entity"' ]' teams_payload.json
yq -iP '.attachments[0].content.body[0].columns[1].items[2].facts += [ { "title": "Assignee", "value": "<at>${{ steps.pick-assignee.outputs.assignee }}</at>" } ]' teams_payload.json
yq -iP '.attachments[0].content.actions[0].url = "${{ steps.create-project-card.outputs.jobURL }}"' teams_payload.json yq -iP '.attachments[0].content.actions[0].url = "${{ steps.create-project-card.outputs.jobURL }}"' teams_payload.json
yq -iP '.attachments[0].content.actions[1].url = "${{ steps.create-project-card.outputs.issueURL }}"' teams_payload.json yq -iP '.attachments[0].content.actions[1].url = "${{ steps.create-project-card.outputs.issueURL }}"' teams_payload.json
yq -iP ".attachments[0].content.actions[2].url = \"${{ steps.create-project-card.outputs.opensearchURL }}\"" teams_payload.json yq -iP ".attachments[0].content.actions[2].url = \"${{ steps.create-project-card.outputs.opensearchURL }}\"" teams_payload.json

View File

@ -9,7 +9,57 @@
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2", "version": "1.2",
"msteams": { "msteams": {
"width": "Full" "width": "Full",
"entities": [
{
"type": "mention",
"text": "<at>elchead</at>",
"mentioned": {
"id": "3931943b-8d4b-4300-ac7e-bbb06c4da27f",
"name": "Adrian Stobbe"
}
},
{
"type": "mention",
"text": "<at>3u13r</at>",
"mentioned": {
"id": "26869b29-b0d6-48f8-a9ed-7a6374410a53",
"name": "Leonard Cohnen"
}
},
{
"type": "mention",
"text": "<at>daniel-weisse</at>",
"mentioned": {
"id": "759f3380-526e-4776-a620-cc713dce6177",
"name": "Daniel Weisse"
}
},
{
"type": "mention",
"text": "<at>katexochen</at>",
"mentioned": {
"id": "fcb7b554-33bb-47f7-8f0e-41b66aab4556",
"name": "Paul Meyer"
}
},
{
"type": "mention",
"text": "<at>derpsteb</at>",
"mentioned": {
"id": "a9a34611-9a38-4c00-a8a2-f87d94c2bf7d",
"name": "Otto Bittner"
}
},
{
"type": "mention",
"text": "<at>malt3</at>",
"mentioned": {
"id": "3012fe21-cff7-499d-88cf-48cf12f2e90c",
"name": "Malte Poll"
}
}
]
}, },
"body": [ "body": [
{ {