Skip to content

publish pipeline: send pager duty alert on worfklow failure #43420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
36 changes: 36 additions & 0 deletions .github/actions/send-pager-duty-event/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Send PagerDuty event"
description: "Use Event API V2 to send a PagerDuty event."
inputs:
integration_key:
description: "The integration key for the PagerDuty service."
required: true
summary:
description: "A brief text summary of the event."
required: true
severity:
description: "The severity of the event. (info, warning, error, critical)"
required: true
source:
description: "Specific human-readable unique identifier, such as a hostname, for the system having the problem."
required: true

runs:
using: "composite"
steps:
- name: Send PagerDuty event
id: send-pager-duty-event
shell: bash
run: |
curl --request 'POST' \
--fail \
--url "https://events.pagerduty.com/v2/enqueue" \
--header 'Content-Type: application/json' \
--data '{
"payload": {
"summary": "${{ inputs.summary }}",
"severity": "${{ inputs.severity }}",
"source": "${{ inputs.source }}"
},
"event_action": "trigger",
"routing_key": "${{ inputs.integration_key }}"
}'
33 changes: 19 additions & 14 deletions .github/workflows/publish_connectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,6 @@ jobs:
airbyte_ci_binary_url: ${{ github.event.inputs.airbyte_ci_binary_url }}
max_attempts: 2

set-instatus-incident-on-failure:
name: Create Instatus Incident on Failure
runs-on: ubuntu-latest
needs:
- publish_connectors
if: ${{ failure() && github.ref == 'refs/heads/master' }}
steps:
- name: Call Instatus Webhook
uses: joelwmale/webhook-action@master
with:
url: ${{ secrets.INSTATUS_CONNECTOR_PUBLISH_PIPELINE_WEBHOOK_URL }}
body: '{ "trigger": "down", "status": "HASISSUES" }'

notify-failure-slack-channel:
name: "Notify Slack Channel on Publish Failures"
runs-on: ubuntu-latest
Expand All @@ -106,7 +93,25 @@ jobs:
{
"channel": "#connector-publish-failures",
"username": "Connectors CI/CD Bot",
"text": "🚨 Publish workflow failed:\n ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
"text": "🚨 Publish workflow failed:\n ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \n merged by ${{ github.actor }} (<@${{ steps.match-github-to-slack-user.outputs.slack_user_ids }}>). "
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.PUBLISH_ON_MERGE_SLACK_WEBHOOK }}

notify-failure-pager-duty:
name: "Notify PagerDuty on Publish Failures"
runs-on: ubuntu-latest
needs:
- publish_connectors
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref == 'refs/heads/master' }}
steps:
- name: Checkout Airbyte
uses: actions/checkout@v4
- name: Notify PagerDuty
id: pager-duty
uses: ./.github/actions/send-pager-duty-event
with:
integration_key: ${{ secrets.PAGER_DUTY_PUBLISH_FAILURES_INTEGRATION_KEY }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a comment in here saying which team's integration key this is? (I assume it's tooling's?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integration keys are not per team, they are per serivce.
We have a Connector Publish Pipeline service.
I set up an "Events API V2" integration (basically a webhook) which our GH workflow POST to.
This creates an alert. Then how this alert is managed is handled in PD settings with escalation policies etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool thanks for clarifying. I think it would be nice if the secret name had the service name in it, or if there was a comment saying exactly which service it's attached to. (I can basically tell by the name but would be nice not to have to guess!)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clnoll I'll add a comment with an URL to the integration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

summary: "Publish workflow failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} merged by ${{ github.actor }}"
severity: "critical"
source: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
Loading