Skip to content

πŸͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

ci: use Slack workflow webhooks for failure notifications (#14004)

Tobias Wochinger6d6d6863991b
diff --git a/.github/actions/notify-slack-failure/action.yml b/.github/actions/notify-slack-failure/action.yml
new file mode 100644
index 0000000000..add31354c0
--- /dev/null
+++ b/.github/actions/notify-slack-failure/action.yml
@@ -0,0 +1,30 @@
+name: Notify Slack Failure
+description: Send a CI failure notification to a Slack Workflow webhook.
+
+inputs:
+ title:
+ description: Slack notification header.
+ required: true
+ message:
+ description: Slack notification fallback text.
+ required: true
+ webhook-url:
+ description: Slack Workflow webhook URL.
+ required: true
+
+runs:
+ using: composite
+ steps:
+ - name: Notify Slack
+ uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
+ with:
+ webhook: ${{ inputs.webhook-url }}
+ webhook-type: webhook-trigger
+ payload: |
+ title: "${{ inputs.title }}"
+ message: "${{ inputs.message }}"
+ ref: "${{ github.ref_name }}"
+ actor: "${{ github.actor }}"
+ event: "${{ github.event_name }}"
+ commit: "${{ github.sha }}"
+ workflow_url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
diff --git a/.github/workflows/_notify_slack_failure.yml b/.github/workflows/_notify_slack_failure.yml
deleted file mode 100644
index 5318a326f2..0000000000
--- a/.github/workflows/_notify_slack_failure.yml
+++ /dev/null
@@ -1,83 +0,0 @@
-name: WorkflowCall - Notify Slack Failure
-
-on:
- workflow_call:
- inputs:
- title:
- description: Slack notification header.
- required: true
- type: string
- message:
- description: Slack notification fallback text.
- required: true
- type: string
- secrets:
- SLACK_WEBHOOK_URL:
- required: true
-
-permissions: {}
-
-jobs:
- notify:
- runs-on: ubuntu-latest
- steps:
- - name: Notify Slack
- uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
- with:
- webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
- webhook-type: incoming-webhook
- payload: |
- {
- "text": "${{ inputs.message }}",
- "blocks": [
- {
- "type": "header",
- "text": {
- "type": "plain_text",
- "text": "${{ inputs.title }}",
- "emoji": true
- }
- },
- {
- "type": "section",
- "fields": [
- {
- "type": "mrkdwn",
- "text": "*Ref:*\n`${{ github.ref_name }}`"
- },
- {
- "type": "mrkdwn",
- "text": "*Triggered by:*\n${{ github.actor }}"
- }
- ]
- },
- {
- "type": "section",
- "fields": [
- {
- "type": "mrkdwn",
- "text": "*Event:*\n`${{ github.event_name }}`"
- },
- {
- "type": "mrkdwn",
- "text": "*Commit:*\n`${{ github.sha }}`"
- }
- ]
- },
- {
- "type": "actions",
- "elements": [
- {
- "type": "button",
- "text": {
- "type": "plain_text",
- "text": "View Workflow Logs",
- "emoji": true
- },
- "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
- "style": "danger"
- }
- ]
- }
- ]
- }
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 644ade0025..691ede0375 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -120,9 +120,16 @@ jobs:
notify-slack-on-failure:
needs: [affected-services, affected-environments, ecs-deploy]
if: failure()
- uses: ./.github/workflows/_notify_slack_failure.yml
- secrets:
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- with:
- title: "❌ Deploy Failed"
- message: "❌ Deploy failed on ${{ github.ref_name }}"
+ runs-on: blacksmith-4vcpu-ubuntu-2404
+ permissions:
+ contents: read
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ - name: Notify Slack
+ uses: ./.github/actions/notify-slack-failure
+ with:
+ title: "❌ Deploy Failed"
+ message: "❌ Deploy failed on ${{ github.ref_name }}"
+ webhook-url: ${{ secrets.SLACK_CI_FAILURE_WORKFLOW_WEBHOOK_URL }}
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
index 202978e46c..6acc3ea7bb 100644
--- a/.github/workflows/pipeline.yml
+++ b/.github/workflows/pipeline.yml
@@ -837,54 +837,17 @@ jobs:
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
working-directory: .
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ if: failure() && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
+ with:
+ persist-credentials: false
- name: Notify Slack
if: failure() && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
- uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
- with:
- webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
- webhook-type: incoming-webhook
- payload: |
- {
- "text": "❌ CI failed on ${{ github.ref_name }}",
- "blocks": [
- {
- "type": "header",
- "text": {
- "type": "plain_text",
- "text": "❌ CI Failed",
- "emoji": true
- }
- },
- {
- "type": "section",
- "fields": [
- {
- "type": "mrkdwn",
- "text": "*Branch/Tag:*\n`${{ github.ref_name }}`"
- },
- {
- "type": "mrkdwn",
- "text": "*Triggered by:*\n${{ github.actor }}"
- }
- ]
- },
- {
- "type": "actions",
- "elements": [
- {
- "type": "button",
- "text": {
- "type": "plain_text",
- "text": "View Workflow Logs",
- "emoji": true
- },
- "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
- "style": "danger"
- }
- ]
- }
- ]
- }
+ uses: ./.github/actions/notify-slack-failure
+ with:
+ title: "❌ CI Failed"
+ message: "❌ CI failed on ${{ github.ref_name }}"
+ webhook-url: ${{ secrets.SLACK_CI_FAILURE_WORKFLOW_WEBHOOK_URL }}
- name: Output job results
run: |
echo "Job results: ${STEPS_SET_SUCCESS_OUTPUT_OUTPUTS_SUCCESS}"
@@ -1156,51 +1119,14 @@ jobs:
- name: Fail when a release image job failed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ if: failure()
+ with:
+ persist-credentials: false
- name: Notify Slack
if: failure()
- uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
- with:
- webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
- webhook-type: incoming-webhook
- payload: |
- {
- "text": "❌ Docker release failed on ${{ github.ref_name }}",
- "blocks": [
- {
- "type": "header",
- "text": {
- "type": "plain_text",
- "text": "❌ Docker Release Failed",
- "emoji": true
- }
- },
- {
- "type": "section",
- "fields": [
- {
- "type": "mrkdwn",
- "text": "*Tag:*\n`${{ github.ref_name }}`"
- },
- {
- "type": "mrkdwn",
- "text": "*Triggered by:*\n${{ github.actor }}"
- }
- ]
- },
- {
- "type": "actions",
- "elements": [
- {
- "type": "button",
- "text": {
- "type": "plain_text",
- "text": "View Workflow Logs",
- "emoji": true
- },
- "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
- "style": "danger"
- }
- ]
- }
- ]
- }
+ uses: ./.github/actions/notify-slack-failure
+ with:
+ title: "❌ Docker Release Failed"
+ message: "❌ Docker release failed on ${{ github.ref_name }}"
+ webhook-url: ${{ secrets.SLACK_CI_FAILURE_WORKFLOW_WEBHOOK_URL }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 993b53ce73..2331f1e233 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,7 +9,7 @@ permissions: {}
jobs:
release:
- runs-on: ubuntu-latest
+ runs-on: blacksmith-4vcpu-ubuntu-2404
environment: "protected branches"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -26,9 +26,16 @@ jobs:
notify-slack-on-failure:
needs: release
if: failure()
- uses: ./.github/workflows/_notify_slack_failure.yml
- secrets:
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- with:
- title: "❌ Release Failed"
- message: "❌ Release failed on ${{ github.ref_name }}"
+ runs-on: blacksmith-4vcpu-ubuntu-2404
+ permissions:
+ contents: read
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ - name: Notify Slack
+ uses: ./.github/actions/notify-slack-failure
+ with:
+ title: "❌ Release Failed"
+ message: "❌ Release failed on ${{ github.ref_name }}"
+ webhook-url: ${{ secrets.SLACK_CI_FAILURE_WORKFLOW_WEBHOOK_URL }}
diff --git a/.github/workflows/sdk-api-spec.yml b/.github/workflows/sdk-api-spec.yml
index 19de6807e8..30f255ad46 100644
--- a/.github/workflows/sdk-api-spec.yml
+++ b/.github/workflows/sdk-api-spec.yml
@@ -17,7 +17,7 @@ permissions:
jobs:
generate-sdk-api-specs:
- runs-on: ubuntu-latest
+ runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -163,9 +163,16 @@ jobs:
notify-slack-on-failure:
needs: generate-sdk-api-specs
if: failure()
- uses: ./.github/workflows/_notify_slack_failure.yml
- secrets:
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- with:
- title: "❌ SDK API Spec Generation Failed"
- message: "❌ SDK API spec generation failed on ${{ github.ref_name }}"
+ runs-on: blacksmith-4vcpu-ubuntu-2404
+ permissions:
+ contents: read
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ - name: Notify Slack
+ uses: ./.github/actions/notify-slack-failure
+ with:
+ title: "❌ SDK API Spec Generation Failed"
+ message: "❌ SDK API spec generation failed on ${{ github.ref_name }}"
+ webhook-url: ${{ secrets.SLACK_CI_FAILURE_WORKFLOW_WEBHOOK_URL }}