From 681eb9e87dea91b99773cd593dd76550c84dab29 Mon Sep 17 00:00:00 2001 From: Jonatan Witoszek Date: Wed, 4 Feb 2026 14:26:10 +0100 Subject: [PATCH] Add slack notifications for workflow failures --- .github/workflows/create-draft-release.yml | 58 ++++++++++++++++++ .../workflows/new-current-patch-release.yml | 54 +++++++++++++++++ .github/workflows/publish-containers.yml | 60 +++++++++++++++++++ 3 files changed, 172 insertions(+) diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml index e52540ac0b2..48de882834b 100644 --- a/.github/workflows/create-draft-release.yml +++ b/.github/workflows/create-draft-release.yml @@ -93,3 +93,61 @@ jobs: --notes "$RELEASE_BODY" echo "✅ Draft release created for $CURRENT_TAG" + + notify-failure: + if: failure() + needs: create-draft-release + runs-on: ubuntu-latest + steps: + - name: Load secrets + uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 + with: + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SLACK_WEBHOOK_URL: "op://Continuous Integration/DASHBOARD_BUILD_FAILURE_SLACK_WEBHOOK/password" + + - name: Notify Slack on failure + uses: slackapi/slack-github-action@v2.0.0 + with: + payload: | + { + "text": "🚨 Draft Release Creation Failed", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "🚨 Draft Release Creation Failed" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Repository:*\n${{ github.repository }}" + }, + { + "type": "mrkdwn", + "text": "*Tag:*\n${{ github.ref_name }}" + }, + { + "type": "mrkdwn", + "text": "*Triggered by:*\n${{ github.actor }}" + }, + { + "type": "mrkdwn", + "text": "*Workflow:*\n${{ github.workflow }}" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Failed Workflow Run>" + } + } + ] + } diff --git a/.github/workflows/new-current-patch-release.yml b/.github/workflows/new-current-patch-release.yml index 10aa067c719..75d38985376 100644 --- a/.github/workflows/new-current-patch-release.yml +++ b/.github/workflows/new-current-patch-release.yml @@ -65,3 +65,57 @@ jobs: git push origin refs/heads/$CURRENT_RELEASE:refs/heads/$CURRENT_RELEASE echo "✅ Successfully recreated release branch $CURRENT_RELEASE from main" + + notify-failure: + if: failure() + needs: recreate-release-branch + runs-on: ubuntu-22.04 + steps: + - name: Load secrets + uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 + with: + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SLACK_WEBHOOK_URL: "op://Continuous Integration/DASHBOARD_BUILD_FAILURE_SLACK_WEBHOOK/password" + + - name: Notify Slack on failure + uses: slackapi/slack-github-action@v2.0.0 + with: + payload: | + { + "text": "🚨 Patch Release Branch Recreation Failed", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "🚨 Patch Release Branch Recreation Failed" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Repository:*\n${{ github.repository }}" + }, + { + "type": "mrkdwn", + "text": "*Triggered by:*\n${{ github.actor }}" + }, + { + "type": "mrkdwn", + "text": "*Workflow:*\n${{ github.workflow }}" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Failed Workflow Run>" + } + } + ] + } diff --git a/.github/workflows/publish-containers.yml b/.github/workflows/publish-containers.yml index e4945beced5..a57748cfa4c 100644 --- a/.github/workflows/publish-containers.yml +++ b/.github/workflows/publish-containers.yml @@ -77,3 +77,63 @@ jobs: run: | echo "Tags: $tags" echo "Digest: $digest" + + notify-failure: + if: failure() + needs: [prepare-variables, build-push] + runs-on: ubuntu-22.04 + permissions: + contents: read + steps: + - name: Load secrets + uses: 1password/load-secrets-action@581a835fb51b8e7ec56b71cf2ffddd7e68bb25e0 # v2.0.0 + with: + export-env: true + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + SLACK_WEBHOOK_URL: "op://Continuous Integration/DASHBOARD_BUILD_FAILURE_SLACK_WEBHOOK/password" + + - name: Notify Slack on failure + uses: slackapi/slack-github-action@v2.0.0 + with: + payload: | + { + "text": "🚨 Docker Image Build Failed", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "🚨 Docker Image Build Failed" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Repository:*\n${{ github.repository }}" + }, + { + "type": "mrkdwn", + "text": "*Version:*\n${{ needs.prepare-variables.outputs.version }}" + }, + { + "type": "mrkdwn", + "text": "*Triggered by:*\n${{ github.actor }}" + }, + { + "type": "mrkdwn", + "text": "*Workflow:*\n${{ github.workflow }}" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Failed Workflow Run>" + } + } + ] + }