From 1299ee28300a070df1d4374c8c94d20f4cf9b43f Mon Sep 17 00:00:00 2001 From: Claudia Garcia Date: Mon, 24 Apr 2023 15:13:41 +0100 Subject: [PATCH] [CONTENT-3783] Configure Slack alerts for CI failures in bitnami/minideb Signed-off-by: Claudia Garcia --- .github/workflows/main.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67f9b22..b745d20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,3 +82,43 @@ jobs: - name: Push Manifests run: | DISTS="buster bullseye latest" bash pushmanifest + + # If the CI Pipeline does not succeed we should notify the interested agents + slack-notif: + runs-on: ubuntu-22.04 + needs: + - build_multiarch + - deploy_manifests + if: always() + name: Notify unsuccessful CI run + steps: + - name: Notify in Slack channel + if: ${{ needs.build_multiarch.result != 'success' || needs.deploy_manifests.result != 'success' }} + uses: slackapi/slack-github-action@v1.23.0 + with: + channel-id: ${{ secrets.CI_SLACK_CHANNEL_ID }} + payload: | + { + "attachments": [ + { + "color": "#CC0000", + "fallback": "Unsuccessful bitnami/minideb CI pipeline", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Unsuccessful `bitnami/minideb` CI pipeline*" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "The CI pipeline for <${{ github.event.head_commit.url }}|bitnami/minideb@${{ github.event.head_commit.id }}> did not succeed. Check the related <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|action run> for more information." + } + } + ] + } + env: + SLACK_BOT_TOKEN: ${{ secrets.CI_SLACK_BOT_TOKEN }}