Skip to content
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

CHANGE (Extension) @W-16812379@ Add pager to alert to smoke test failure #143

Merged
merged 7 commits into from
Oct 15, 2024
41 changes: 41 additions & 0 deletions .github/workflows/daily-smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,45 @@ jobs:
create-vsix-artifact:
name: 'Upload VSIX as artifact'
uses: ./.github/workflows/create-vsix-artifact.yml
# Step 4: Report any problems
report-problems:
name: 'Report problems'
runs-on: ubuntu-latest
needs: [build-scanner-tarball, smoke-test, create-vsix-artifact]
if: ${{ failure() || cancelled() }}
steps:
- name: Report problems
shell: bash
env:
IS_CRITICAL: ${{ contains(join(steps.*.outcome), 'failure') || contains(join(steps.*.outcome), 'skipped') }}
RUN_LINK: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
if [[ ${{ env.IS_CRITICAL }} == true ]]; then
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@stephen-carter-at-sf @jfeingold35 : This logic is shared across multiple actions. Once the other PR is also approved, I could extract into a shared yml.

ALERT_SEV="critical"
ALERT_SUMMARY="Production heartbeat script failed on ${{ runner.os }}"
else
ALERT_SEV="info"
ALERT_SUMMARY="Production heartbeat script succeeded with retries on ${{ runner.os }}"
fi

generate_post_data() {
cat <<EOF
{"payload": {
"summary": "${ALERT_SUMMARY}",
"source": "Github Actions",
"severity": "${ALERT_SEV}"
},
"links": [{
"href": "${{ env.RUN_LINK }}",
"text": "Link to action execution"
}],
"event_action": "trigger",
"dedup_key": "GH-HB-${{ matrix.os.vm }}-${{ matrix.node }}",
"routing_key": "${{ secrets.PAGERDUTY_HEARTBEAT_KEY }}"
}
EOF
}

curl --request POST --data "$(generate_post_data)" https://events.pagerduty.com/v2/enqueue