Skip to content

Commit 9c0a0ae

Browse files
committed
ci: add failure slack notifications to mirror workflow
1 parent 86c5a64 commit 9c0a0ae

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/mirror.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,44 @@ jobs:
101101
image-registry-password: ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }}
102102
image-repository: ${{ format('sdp/{0}', env.IMAGE_REPOSITORY) }}
103103
image-index-manifest-tag: ${{ inputs.image-index-manifest-tag }}
104+
105+
notify:
106+
name: Failure Notification
107+
needs: [mirror-image, publish_manifests]
108+
runs-on: ubuntu-latest
109+
if: failure()
110+
steps:
111+
- uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
112+
with:
113+
channel-id: "C07UG6JH44F" # notifications-container-images
114+
payload: |
115+
{
116+
"text": "*${{ github.workflow }}* failed",
117+
"attachments": [
118+
{
119+
"pretext": "See the details below for a summary of which job(s) failed.",
120+
"color": "#aa0000",
121+
"fields": [
122+
{
123+
"title": "Mirror Image",
124+
"short": true,
125+
"value": "${{ needs.mirror-image.result }}"
126+
},
127+
{
128+
"title": "Build/Publish Manifests",
129+
"short": true,
130+
"value": "${{ needs.publish_manifests.result }}"
131+
}
132+
],
133+
"actions": [
134+
{
135+
"type": "button",
136+
"text": "Go to workflow run",
137+
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
138+
}
139+
]
140+
}
141+
]
142+
}
143+
env:
144+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_CONTAINER_IMAGE_TOKEN }}

0 commit comments

Comments
 (0)