Skip to content

Commit eedc99d

Browse files
committed
Test failure
1 parent 800e079 commit eedc99d

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/actions/common/func.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,4 +413,49 @@ slack_format_docker_PR_message() {
413413
]
414414
}
415415
EOF
416+
}
417+
418+
slack_format_docker_PR_failed_message() {
419+
header=$1
420+
workflow_url=$2
421+
footer=$3
422+
if [ -z "$header" ]; then
423+
header=" "
424+
fi
425+
if [ -z "$footer" ]; then
426+
footer=" "
427+
fi
428+
429+
# Create Slack message payload
430+
cat << EOF
431+
{
432+
"icon_emoji": ":redis-circle:",
433+
"text": "$header",
434+
"blocks": [
435+
{
436+
"type": "header",
437+
"text": {
438+
"type": "plain_text",
439+
"text": "❌ $header"
440+
}
441+
},
442+
{
443+
"type": "section",
444+
"text": {
445+
"type": "mrkdwn",
446+
"text": "Workflow run: $workflow_url"
447+
}
448+
},
449+
{
450+
"type": "context",
451+
"elements": [
452+
{
453+
"type": "mrkdwn",
454+
"text": "$footer"
455+
}
456+
]
457+
}
458+
]
459+
}
460+
EOF
416461
}

.github/workflows/release_publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
update-stackbrew-file $MAJOR_VERSION --input official-images/library/redis --output official-images/library/redis
9696
cd official-images && git diff --color
9797
cd -
98+
exit 1
9899
99100
- name: Create pull request to official-images
100101
id: create-pr
@@ -150,4 +151,15 @@ jobs:
150151
. ${GITHUB_WORKSPACE}/.github/actions/common/func.sh
151152
152153
slack_format_docker_PR_message "${{ steps.parse-release.outputs.release_version }}" "${{ steps.create-pr.outputs.pull-request-url }}" "$footer" \
154+
| curl -d@- "${{ secrets.SLACK_WEB_HOOK_URL }}"
155+
156+
- name: Send Failure Slack notification
157+
if: failure()
158+
run: |
159+
workflow_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
160+
footer="Repository: ${{ github.repository }} | Commit: \`${{ github.sha }}\`"
161+
162+
. ${GITHUB_WORKSPACE}/.github/actions/common/func.sh
163+
164+
slack_format_failure_message "Docker PR failed for Redis: ${{ steps.parse-release.outputs.release_version || 'unknown'}}" "$workflow_url" "$footer" \
153165
| curl -d@- "${{ secrets.SLACK_WEB_HOOK_URL }}"

0 commit comments

Comments
 (0)