Skip to content

Commit e5e0676

Browse files
committed
CI: Add Slack alert to automatically triggered workflows
Alert on failures for automatically triggered workflows. For manually triggered workflows we rely on GitHub emails to the individual that triggered the workflow. See the "Workflow builder" approach in https://github.com/slackapi/slack-github-action/.
1 parent 7d98067 commit e5e0676

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

.github/workflows/stackhpc-build-kayobe-image.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,25 @@ jobs:
9898
push: true
9999
tags: ${{ steps.meta.outputs.tags }}
100100
labels: ${{ steps.meta.outputs.labels }}
101+
102+
- name: Send message to Slack via Workflow Builder
103+
uses: slackapi/[email protected]
104+
with:
105+
payload: |
106+
{
107+
"channel-id": "${{ env.SLACK_CHANNEL_ID }}",
108+
"inputs": "${{ env.INPUTS }}",
109+
"message": "${{ env.MESSAGE }}",
110+
"results-url": "${{ env.RESULTS_URL }}",
111+
"workflow-url": "${{ env.WORKFLOW_URL }}"
112+
}
113+
env:
114+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
115+
# #release-train-alerts
116+
SLACK_CHANNEL_ID: C03B28HRP53
117+
INPUTS: >-
118+
branch: ${{ github.ref_name }}
119+
MESSAGE: "SKC Build Kayobe Image workflow failed :sob:"
120+
RESULTS_URL: "N/A"
121+
WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
122+
if: failure() && github.event_name == 'push'

.github/workflows/stackhpc-ci-cleanup.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,24 @@ jobs:
7575
OS_CLOUD: openstack
7676
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
7777
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
78+
79+
- name: Send message to Slack via Workflow Builder
80+
uses: slackapi/[email protected]
81+
with:
82+
payload: |
83+
{
84+
"channel-id": "${{ env.SLACK_CHANNEL_ID }}",
85+
"inputs": "${{ env.INPUTS }}",
86+
"message": "${{ env.MESSAGE }}",
87+
"results-url": "${{ env.RESULTS_URL }}",
88+
"workflow-url": "${{ env.WORKFLOW_URL }}"
89+
}
90+
env:
91+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
92+
# #release-train-alerts
93+
SLACK_CHANNEL_ID: C03B28HRP53
94+
INPUTS: "N/A"
95+
MESSAGE: "SKC CI Cleanup workflow failed :sob:"
96+
RESULTS_URL: "N/A"
97+
WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
98+
if: failure()

.github/workflows/stackhpc-promote.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,25 @@ jobs:
2727
- name: Display link to package repository promotion workflows
2828
run: |
2929
echo "::notice Package repository promote workflow: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/package-promote.yml"
30+
31+
- name: Send message to Slack via Workflow Builder
32+
uses: slackapi/[email protected]
33+
with:
34+
payload: |
35+
{
36+
"channel-id": "${{ env.SLACK_CHANNEL_ID }}",
37+
"inputs": "${{ env.INPUTS }}",
38+
"message": "${{ env.MESSAGE }}",
39+
"results-url": "${{ env.RESULTS_URL }}",
40+
"workflow-url": "${{ env.WORKFLOW_URL }}"
41+
}
42+
env:
43+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
44+
# #release-train-alerts
45+
SLACK_CHANNEL_ID: C03B28HRP53
46+
INPUTS: >-
47+
branch: ${{ github.ref_name }}
48+
MESSAGE: "SKC promote workflow failed :sob:"
49+
RESULTS_URL: "N/A"
50+
WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
51+
if: failure()

0 commit comments

Comments
 (0)