Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions .github/actions/common/slack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

slack_format_success_message() {
jq --arg release_tag "$1" --arg url_prefix "$2" --arg footer "$3" --arg env "$4" '
def generate_repo_prefix(package_name):
package_name[:1] + "/" + package_name[:2];
{
"icon_emoji": ":redis-circle:",
"text": (":homebrew: Homebrew Packages Published for Redis: " + $release_tag + " (" + $env + ")"),
Expand All @@ -21,28 +19,13 @@ def generate_repo_prefix(package_name):
}
}
] +
(
to_entries
| map(
. as $dist_entry |
.value | to_entries
| map({
"type": "section",
"text": {
"type": "mrkdwn",
"text": (
"Distribution: *" + $dist_entry.key + "* | Architecture: *" + .key + "*\n" +
(
.value
| map("• <" + $url_prefix + "/" + $dist_entry.key + "/" + generate_repo_prefix(.) + "/" + . + "|" + . + ">")
| join("\n")
)
)
}
})
)
| flatten
) +
map({
"type": "section",
"text": {
"type": "mrkdwn",
"text": ("Architecture: *" + . + "*\n• <" + $url_prefix + "/redis-oss-" + $release_tag + "-" + . + ".zip|redis-oss-" + $release_tag + "-" + . + ".zip>")
}
}) +
[
{
"type": "context",
Expand All @@ -54,6 +37,7 @@ def generate_repo_prefix(package_name):
)
}'
}

slack_format_failure_message() {
header=$1
workflow_url=$2
Expand Down
44 changes: 22 additions & 22 deletions .github/workflows/release_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ jobs:

# Notify only about build failures
# as publish workflow will notify about publish success or failure
# slack-failure-notification:
# needs: build-n-test
# runs-on: ubuntu-latest
# if: failure()
# steps:
# - name: Detect env name
# id: detect-env
# run: |
# if [ "${{ inputs.release_type }}" = "public" ]; then
# env_name="production"
# elif [ "${{ inputs.release_type }}" = "internal" ]; then
# env_name="staging"
# fi
# echo "env_name=$env_name" >> $GITHUB_OUTPUT
# - name: Send Failure Slack notification
# uses: ./.github/actions/slack-notification
# with:
# slack_func: slack_format_failure_message
# release_tag: ${{ github.event.inputs.release_tag }}
# env: ${{ steps.detect-env.outputs.env_name }}
# message: ":homebrew: Homebrew package build failed"
# SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
slack-failure-notification:
needs: build-n-test
runs-on: ubuntu-latest
if: failure()
steps:
- name: Detect env name
id: detect-env
run: |
if [ "${{ inputs.release_type }}" = "public" ]; then
env_name="production"
elif [ "${{ inputs.release_type }}" = "internal" ]; then
env_name="staging"
fi
echo "env_name=$env_name" >> $GITHUB_OUTPUT
- name: Send Failure Slack notification
uses: ./.github/actions/slack-notification
with:
slack_func: slack_format_failure_message
release_tag: ${{ github.event.inputs.release_tag }}
env: ${{ steps.detect-env.outputs.env_name }}
message: ":homebrew: Homebrew package build failed"
SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
40 changes: 20 additions & 20 deletions .github/workflows/release_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,23 @@ jobs:
path: result.json
retention-days: 90

# - name: Send Success Slack notification
# uses: ./.github/actions/slack-notification
# with:
# slack_func: slack_format_success_message
# release_tag: ${{ github.event.inputs.release_tag }}
# url_prefix: ${{ steps.validate-inputs.outputs.url_prefix }}
# env: ${{ steps.validate-inputs.outputs.env_name }}
# packages_json: ${{ steps.upload.outputs.packages_json }}
# SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
#
# - name: Send Failure Slack notification
# if: failure()
# uses: ./.github/actions/slack-notification
# with:
# slack_func: slack_format_failure_message
# release_tag: ${{ github.event.inputs.release_tag }}
# env: ${{ steps.validate-inputs.outputs.env_name }}
# packages_json: ${{ steps.upload.outputs.packages_json }}
# message: ":debian: Debian package upload failed"
# SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
- name: Send Success Slack notification
uses: ./.github/actions/slack-notification
with:
slack_func: slack_format_success_message
release_tag: ${{ github.event.inputs.release_tag }}
url_prefix: ${{ steps.validate-inputs.outputs.url_prefix }}
env: ${{ steps.validate-inputs.outputs.env_name }}
packages_json: ${{ steps.upload.outputs.packages_json }}
SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}

- name: Send Failure Slack notification
if: failure()
uses: ./.github/actions/slack-notification
with:
slack_func: slack_format_failure_message
release_tag: ${{ github.event.inputs.release_tag }}
env: ${{ steps.validate-inputs.outputs.env_name }}
packages_json: ${{ steps.upload.outputs.packages_json }}
message: ":homebrew: Homebrew package upload failed"
SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
Loading