Skip to content

Commit dc6c530

Browse files
authored
ci: Add failure notification job (#214)
ci: Add failure notification
1 parent 683a12c commit dc6c530

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

.github/workflows/dev_jupyter-pyspark-with-alibi-detect.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: ./.github/workflows/reusable_build_image.yaml
2020
secrets:
2121
harbor-robot-secret: ${{ secrets.HARBOR_ROBOT_DEMOS_GITHUB_ACTION_BUILD_SECRET }}
22+
slack-token: ${{ secrets.SLACK_CONTAINER_IMAGE_TOKEN }}
2223
with:
2324
image-name: jupyter-pyspark-with-alibi-detect
2425
# TODO (@NickLarsenNZ): Use a versioned image with stackable0.0.0-dev or stackableXX.X.X so that

.github/workflows/dev_nifi.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
uses: ./.github/workflows/reusable_build_image.yaml
1919
secrets:
2020
harbor-robot-secret: ${{ secrets.HARBOR_ROBOT_DEMOS_GITHUB_ACTION_BUILD_SECRET }}
21+
slack-token: ${{ secrets.SLACK_CONTAINER_IMAGE_TOKEN }}
2122
with:
2223
image-name: nifi
2324
# TODO (@NickLarsenNZ): Use a versioned image with stackable0.0.0-dev or stackableXX.X.X so that

.github/workflows/reusable_build_image.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
harbor-robot-secret:
1515
description: The secret for the Harbor robot user used to push images and manifest
1616
required: true
17+
slack-token:
18+
description: The Slack token used to post failure notifications
19+
required: true
1720

1821
jobs:
1922
build:
@@ -79,3 +82,44 @@ jobs:
7982
image-registry-password: ${{ secrets.harbor-robot-secret }}
8083
image-repository: demos/${{ env.IMAGE_NAME }}
8184
image-index-manifest-tag: ${{ env.IMAGE_VERSION }}
85+
86+
notify:
87+
name: Failure Notification
88+
needs: [build, publish_manifests]
89+
runs-on: ubuntu-latest
90+
if: failure()
91+
steps:
92+
- uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
93+
with:
94+
channel-id: "C07UG6JH44F" # notifications-container-images
95+
payload: |
96+
{
97+
"text": "*${{ github.workflow }}* failed (attempt ${{ github.run_attempt }})",
98+
"attachments": [
99+
{
100+
"pretext": "See the details below for a summary of which job(s) failed.",
101+
"color": "#aa0000",
102+
"fields": [
103+
{
104+
"title": "Build/Publish Image",
105+
"short": true,
106+
"value": "${{ needs.build.result }}"
107+
},
108+
{
109+
"title": "Build/Publish Manifests",
110+
"short": true,
111+
"value": "${{ needs.publish_manifests.result }}"
112+
}
113+
],
114+
"actions": [
115+
{
116+
"type": "button",
117+
"text": "Go to workflow run",
118+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}"
119+
}
120+
]
121+
}
122+
]
123+
}
124+
env:
125+
SLACK_BOT_TOKEN: ${{ secrets.slack-token }}

0 commit comments

Comments
 (0)