Skip to content

Commit a5def76

Browse files
authored
Implement Slack notification for E2E test failures
1 parent 9f5563b commit a5def76

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/test.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,19 @@ jobs:
5454
- name: Check if all pods are running
5555
run: kubectl get pods -A -o jsonpath='{range .items[*]}{.status.phase}{"\n"}{end}' | grep -qv "^Running$" && echo "Not all pods are running" && exit 1 || echo "OK"
5656

57+
notify-slack:
58+
if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event_name == 'schedule') }}
59+
needs: [test-last-release]
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Notify Slack
63+
env:
64+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
65+
run: |
66+
curl -X POST "$SLACK_WEBHOOK_URL" \
67+
-H 'Content-Type: application/json' \
68+
-d "{
69+
\"username\": \"E2E tests in Kubernetes Helm Chart\",
70+
\"icon_emoji\": \":warning:\",
71+
\"text\": \":red_circle: *${{ github.workflow }}* failed on \`${{ github.ref_name }}\`\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View failing run>\"
72+
}"

0 commit comments

Comments
 (0)