mirror of
https://github.com/bitnami/charts.git
synced 2026-02-19 19:47:22 +08:00
github-actions: Add gchat notification (#31832)
Signed-off-by: Miguel Ruiz <miguel.ruiz@broadcom.com>
This commit is contained in:
12
.github/workflows/cd-pipeline.yml
vendored
12
.github/workflows/cd-pipeline.yml
vendored
@@ -169,3 +169,15 @@ jobs:
|
||||
echo "Could not update the index after $max_attempts attempts"
|
||||
exit 1
|
||||
fi
|
||||
notify:
|
||||
name: Send notification
|
||||
needs:
|
||||
- vib-publish
|
||||
- update-deprecated-index
|
||||
if: ${{ always() && (needs.vib-publish.result == 'failure' || needs.update-deprecated-index.result == 'failure') }}
|
||||
uses: bitnami/support/.github/workflows/gchat-notification.yml@main
|
||||
with:
|
||||
workflow: ${{ github.workflow }}
|
||||
job-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
secrets:
|
||||
webhook-url: ${{ secrets.GCHAT_CONTENT_ALERTS_WEBHOOK_URL }}
|
||||
|
||||
42
.github/workflows/gchat-notification.yml
vendored
42
.github/workflows/gchat-notification.yml
vendored
@@ -1,42 +0,0 @@
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
name: 'GChat Notification'
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
workflow:
|
||||
type: string
|
||||
required: true
|
||||
job-url:
|
||||
type: string
|
||||
required: true
|
||||
repository:
|
||||
type: string
|
||||
secrets:
|
||||
GCHAT_WEBHOOK_URL:
|
||||
required: true
|
||||
# Remove all permissions by default
|
||||
permissions: {}
|
||||
jobs:
|
||||
notification:
|
||||
name: Google Chat Notification
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Notify
|
||||
env:
|
||||
JOB_URL: ${{ inputs.job-url }}
|
||||
GH_WORKFLOW: ${{ inputs.workflow }}
|
||||
GH_REPOSITORY: ${{ inputs.repository != '' && inputs.repository || github.repository }}
|
||||
GCHAT_WEBHOOK_URL: ${{ secrets.GCHAT_WEBHOOK_URL }}
|
||||
run: |
|
||||
tmp_file=$(mktemp)
|
||||
cat >"${tmp_file}"<<EOF
|
||||
⚠️ [${GH_REPOSITORY}] Failure detected on '${GH_WORKFLOW}' workflow ⚠️
|
||||
📑 See details <${JOB_URL}|here>.
|
||||
EOF
|
||||
|
||||
# Use curl to send the JSON to Google.
|
||||
escapedText=$(sed -e 's/\n/\\n/g' -e 's/"/\\"/g' -e "s/'/\\'/g" "${tmp_file}")
|
||||
json="{\"text\": \"$escapedText\"}"
|
||||
curl -o /tmp/out -s --fail -X POST -H 'Content-Type: application/json' -d "$json" "${GCHAT_WEBHOOK_URL}"
|
||||
5
.github/workflows/index-monitor.yml
vendored
5
.github/workflows/index-monitor.yml
vendored
@@ -113,8 +113,9 @@ jobs:
|
||||
name: Send notification
|
||||
needs: [validation-check, integrity-check]
|
||||
if: ${{ always() && (needs.validation-check.outputs.result != 'ok' || needs.integrity-check.outputs.result != 'ok') }}
|
||||
uses: bitnami/charts/.github/workflows/gchat-notification.yml@main
|
||||
uses: bitnami/support/.github/workflows/gchat-notification.yml@main
|
||||
with:
|
||||
workflow: ${{ github.workflow }}
|
||||
job-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
secrets: inherit
|
||||
secrets:
|
||||
webhook-url: ${{ secrets.GCHAT_WEBHOOK_URL }}
|
||||
|
||||
11
.github/workflows/index-update.yml
vendored
11
.github/workflows/index-update.yml
vendored
@@ -115,3 +115,14 @@ jobs:
|
||||
# Push changes
|
||||
git add bitnami/index.yaml && git commit --signoff --amend --no-edit
|
||||
git push origin index --force-with-lease=index:${current_commit_id}
|
||||
notify:
|
||||
name: Send notification
|
||||
needs:
|
||||
- update-index
|
||||
if: ${{ always() && (needs.update-index.result == 'failure') }}
|
||||
uses: bitnami/support/.github/workflows/gchat-notification.yml@main
|
||||
with:
|
||||
workflow: ${{ github.workflow }}
|
||||
job-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
secrets:
|
||||
webhook-url: ${{ secrets.GCHAT_CONTENT_ALERTS_WEBHOOK_URL }}
|
||||
|
||||
11
.github/workflows/push-tag.yml
vendored
11
.github/workflows/push-tag.yml
vendored
@@ -86,3 +86,14 @@ jobs:
|
||||
git tag ${CHART}/${chart_version}
|
||||
git push --tags
|
||||
fi
|
||||
notify:
|
||||
name: Send notification
|
||||
needs:
|
||||
- push-tag
|
||||
if: ${{ always() && (needs.push-tag.result == 'failure') }}
|
||||
uses: bitnami/support/.github/workflows/gchat-notification.yml@main
|
||||
with:
|
||||
workflow: ${{ github.workflow }}
|
||||
job-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
secrets:
|
||||
webhook-url: ${{ secrets.GCHAT_CONTENT_ALERTS_WEBHOOK_URL }}
|
||||
|
||||
Reference in New Issue
Block a user