@@ -12,7 +12,7 @@ schedules:
12
12
- main
13
13
14
14
parameters :
15
- # Skipped due to DB locks
15
+ # Skipped due to DB locks
16
16
- name : sqliteAcceptanceTests
17
17
displayName : Run SQLite Acceptance Tests
18
18
type : boolean
@@ -482,4 +482,52 @@ stages:
482
482
testResultsFormat : ' JUnit'
483
483
testResultsFiles : ' *.xml'
484
484
searchFolder : " tests/Umbraco.Tests.AcceptanceTest/results"
485
- testRunTitle : " $(Agent.JobName)"
485
+ testRunTitle : " $(Agent.JobName)"
486
+
487
+ - stage : NotifySlackBot
488
+ displayName : Notify Slack on Failure
489
+ dependsOn : E2E
490
+ # This stage will only run if the E2E tests fail or succeed with issues
491
+ condition : or(
492
+ eq(dependencies.E2E.result, 'failed'),
493
+ eq(dependencies.E2E.result, 'succeededWithIssues'))
494
+ jobs :
495
+ - job : PostToSlack
496
+ displayName : Send Slack Notification
497
+ pool :
498
+ vmImage : ' ubuntu-latest'
499
+ steps :
500
+ # We send a payload to the Slack webhook URL, which will post a message to a specific channel
501
+ - bash : |
502
+ PROJECT_NAME_ENCODED=$(echo -n "$SYSTEM_TEAMPROJECT" | jq -s -R -r @uri)
503
+ PIPELINE_URL="${SYSTEM_TEAMFOUNDATIONCOLLECTIONURI}${PROJECT_NAME_ENCODED}/_build/results?buildId=${BUILD_BUILDID}&view=ms.vss-test-web.build-test-results-tab"
504
+
505
+ PAYLOAD="{
506
+ \"attachments\": [
507
+ {
508
+ \"color\": \"#ff0000\",
509
+ \"pretext\": \"Nightly E2E pipeline *${BUILD_DEFINITIONNAME}* (#${BUILD_BUILDNUMBER}) failed!\",
510
+ \"title\": \"View Failed E2E Test Results\",
511
+ \"title_link\": \"$PIPELINE_URL\",
512
+ \"fields\": [
513
+ {
514
+ \"title\": \"Pipeline\",
515
+ \"value\": \"${BUILD_DEFINITIONNAME}\",
516
+ \"short\": true
517
+ },
518
+ {
519
+ \"title\": \"Build ID\",
520
+ \"value\": \"${BUILD_BUILDID}\",
521
+ \"short\": true
522
+ }
523
+ ]
524
+ }
525
+ ]
526
+ }"
527
+
528
+ echo "Sending Slack message to: $PIPELINE_URL"
529
+ curl -X POST -H 'Content-type: application/json' \
530
+ --data "$PAYLOAD" \
531
+ "$SLACK_WEBHOOK_URL"
532
+ env:
533
+ SLACK_WEBHOOK_URL: $(E2ESLACKWEBHOOKURL)
0 commit comments