Skip to content

Commit 71617ab

Browse files
committed
ci: improve API e2e tests workflow with Slack failure notifications
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 766c515 commit 71617ab

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

.github/workflows/api-e2e-tests.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
with:
5454
services: api-e2e
5555

56-
- name: Wait for api-e2e
56+
- name: Wait for api-e2e service to be ready
5757
run: |
5858
set -euo pipefail
5959
# Builder only runs kubectl set image; wait for the new revision before health.
@@ -73,3 +73,37 @@ jobs:
7373
AUTH0_API_E2E_CLIENT_ID: ${{ secrets.AUTH0_API_E2E_CLIENT_ID }}
7474
AUTH0_API_E2E_CLIENT_SECRET: ${{ secrets.AUTH0_API_E2E_CLIENT_SECRET }}
7575
run: bash .github/scripts/public-api-e2e-tests.sh
76+
77+
- name: Notify Slack on failure
78+
if: failure()
79+
env:
80+
CDP_ALERTS_SLACK_WEBHOOK_URL: ${{ secrets.CDP_ALERTS_SLACK_WEBHOOK_URL }}
81+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
82+
EVENT_NAME: ${{ github.event_name }}
83+
run: |
84+
set -euo pipefail
85+
payload="$(jq -n \
86+
--arg run_url "$RUN_URL" \
87+
--arg event "$EVENT_NAME" \
88+
'{
89+
blocks: [
90+
{
91+
type: "header",
92+
text: {
93+
type: "plain_text",
94+
text: ":rotating_light: Public API e2e tests failed",
95+
emoji: true
96+
}
97+
},
98+
{
99+
type: "section",
100+
text: {
101+
type: "mrkdwn",
102+
text: ("*Workflow:* `API e2e tests`\n*Event:* `" + $event + "`\n*Run:* <" + $run_url + "|View run>")
103+
}
104+
}
105+
]
106+
}')"
107+
curl -fsS -X POST "$CDP_ALERTS_SLACK_WEBHOOK_URL" \
108+
-H 'Content-Type: application/json' \
109+
-d "$payload"

0 commit comments

Comments
 (0)