Skip to content

Commit 3606702

Browse files
authored
Use production workflow to send Slack message for fenix and fenix-beta product health (#335)
1 parent 63f63ac commit 3606702

2 files changed

Lines changed: 62 additions & 27 deletions

File tree

.github/workflows/production-daily.yml

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,72 @@ jobs:
121121
run: |
122122
python __main__.py --report-type sentry-issues --project fenix
123123
python __main__.py --report-type sentry-rates --project fenix
124+
- name: Construct JSON for Slack (Android)
125+
id: construct-json-fenix
126+
run: |
127+
python -m api.sentry.utils --file ./sentry_rates.csv --project fenix
128+
ls sentry-slack-fenix.json
129+
echo "has_data=$([ $(wc -l < sentry_rates.csv) -gt 1 ] && echo true || echo false)" >> $GITHUB_OUTPUT
130+
- name: Send health notification to Slack (Android)
131+
id: slack-sentry-fenix
132+
if: steps.construct-json-fenix.outputs.has_data == 'true'
133+
uses: slackapi/[email protected]
134+
with:
135+
payload-file-path: "./sentry-slack-fenix.json"
136+
payload-templated: true
137+
webhook: ${{ secrets.SLACK_WEBHOOK_PRODUCT_HEALTH }}
138+
webhook-type: incoming-webhook
124139

125140
- name: Sentry query (Android Beta)
126141
run: |
127142
python __main__.py --report-type sentry-issues --project fenix-beta
128143
python __main__.py --report-type sentry-rates --project fenix-beta
129-
130-
# Note: We have sent the Android and Android Beta notifications to
131-
# mobile-alerts-product-health channel.
144+
- name: Construct JSON for Slack (Android Beta)
145+
id: construct-json-fenix-beta
146+
run: |
147+
python -m api.sentry.utils --file ./sentry_rates.csv --project fenix-beta
148+
ls sentry-slack-fenix-beta.json
149+
echo "has_data=$([ $(wc -l < sentry_rates.csv) -gt 1 ] && echo true || echo false)" >> $GITHUB_OUTPUT
150+
- name: Send health notification to Slack (Android Beta)
151+
id: slack-sentry-fenix-beta
152+
if: steps.construct-json-fenix-beta.outputs.has_data == 'true'
153+
uses: slackapi/[email protected]
154+
with:
155+
payload-file-path: "./sentry-slack-fenix-beta.json"
156+
payload-templated: true
157+
webhook: ${{ secrets.SLACK_WEBHOOK_PRODUCT_HEALTH }}
158+
webhook-type: incoming-webhook
159+
- name: Notify Slack on any type of failure
160+
if: failure()
161+
uses: slackapi/[email protected]
162+
with:
163+
payload: |
164+
{
165+
"text": ":x: *Sentry report failed*\nWorkflow: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} #${{ github.run_number }}>",
166+
"blocks": [
167+
{
168+
"type": "section",
169+
"text": {
170+
"type": "mrkdwn",
171+
"text": ":x: *Sentry report failed*\nWorkflow: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} #${{ github.run_number }}>"
172+
}
173+
},
174+
{
175+
"type": "divider"
176+
},
177+
{
178+
"type": "context",
179+
"elements": [
180+
{
181+
"type": "mrkdwn",
182+
"text": ":testops-notify: Created by Mobile Test Engineering"
183+
}
184+
]
185+
}
186+
]
187+
}
188+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_TEST_ALERTS_SANDBOX }}
189+
webhook-type: incoming-webhook
132190

133191
notify:
134192
name: Send workflow status notification

.github/workflows/staging-daily.yml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,43 +108,20 @@ jobs:
108108
run: |
109109
python __main__.py --report-type sentry-issues --project fenix
110110
python __main__.py --report-type sentry-rates --project fenix
111-
112111
- name: Construct JSON for Slack (Android)
113-
id: construct-json-fenix
114112
run: |
115113
python -m api.sentry.utils --file ./sentry_rates.csv --project fenix
116114
ls sentry-slack-fenix.json
117-
echo "has_data=$([ $(wc -l < sentry_rates.csv) -gt 1 ] && echo true || echo false)" >> $GITHUB_OUTPUT
118-
119-
- name: Send health notification to Slack (Android)
120-
id: slack-sentry-fenix
121-
if: steps.construct-json-fenix.outputs.has_data == 'true'
122-
uses: slackapi/[email protected]
123-
with:
124-
payload-file-path: "./sentry-slack-fenix.json"
125-
payload-templated: true
126-
webhook: ${{ secrets.SLACK_WEBHOOK_PRODUCT_HEALTH }}
127-
webhook-type: incoming-webhook
128115
129116
- name: Sentry query (Android Beta)
130117
run: |
131118
python __main__.py --report-type sentry-issues --project fenix-beta
132119
python __main__.py --report-type sentry-rates --project fenix-beta
133120
- name: Construct JSON for Slack (Android Beta)
134-
id: construct-json-fenix-beta
135121
run: |
136122
python -m api.sentry.utils --file ./sentry_rates.csv --project fenix-beta
137123
ls sentry-slack-fenix-beta.json
138-
echo "has_data=$([ $(wc -l < sentry_rates.csv) -gt 1 ] && echo true || echo false)" >> $GITHUB_OUTPUT
139-
- name: Send health notification to Slack (Android Beta)
140-
id: slack-sentry-fenix-beta
141-
if: steps.construct-json-fenix-beta.outputs.has_data == 'true'
142-
uses: slackapi/[email protected]
143-
with:
144-
payload-file-path: "./sentry-slack-fenix-beta.json"
145-
payload-templated: true
146-
webhook: ${{ secrets.SLACK_WEBHOOK_PRODUCT_HEALTH }}
147-
webhook-type: incoming-webhook
124+
148125
- name: Notify Slack on any type of failure
149126
if: failure()
150127
uses: slackapi/[email protected]

0 commit comments

Comments
 (0)