Skip to content

Commit 7f729dc

Browse files
Merge pull request #1667 from snyk/update-failing-tests-notifications
Update failing tests notifications
2 parents f811d4d + 3c8814f commit 7f729dc

File tree

1 file changed

+48
-8
lines changed

1 file changed

+48
-8
lines changed

.circleci/config.yml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,56 @@ orbs:
1313
go: circleci/[email protected]
1414
snyk: snyk/[email protected]
1515
gh: circleci/[email protected]
16+
slack: circleci/[email protected]
1617
parameters:
1718
ACC_TESTS:
1819
type: string
1920
description: manually run acceptance tests
2021
default: '0'
22+
commands:
23+
notify_slack_on_failure:
24+
steps:
25+
- slack/notify:
26+
channel: team-cloud-context-alerts
27+
event: fail
28+
custom: |
29+
{
30+
"blocks": [
31+
{
32+
"type": "header",
33+
"text": {
34+
"type": "plain_text",
35+
"text": ":warning: Driftctl acceptance tests failed :warning:",
36+
"emoji": true
37+
}
38+
},
39+
{
40+
"type": "divider"
41+
},
42+
{
43+
"type": "section",
44+
"fields": [
45+
{
46+
"type": "mrkdwn",
47+
"text": "*Suite*: ${ACC_PATTERN}"
48+
},
49+
{
50+
"type": "mrkdwn",
51+
"text": "*Branch*: ${CIRCLE_BRANCH}"
52+
}
53+
],
54+
"accessory": {
55+
"type": "button",
56+
"text": {
57+
"type": "plain_text",
58+
"emoji": true,
59+
"text": "View Job"
60+
},
61+
"value": "${CIRCLE_BUILD_URL}"
62+
}
63+
}
64+
]
65+
}
2166
jobs:
2267
test_acc:
2368
parameters:
@@ -49,14 +94,7 @@ jobs:
4994
name: Run acceptance tests
5095
command: make acc
5196
no_output_timeout: 30m
52-
- run:
53-
name: Discord notification
54-
when: on_fail
55-
command: |
56-
curl -X POST \
57-
-H "Content-Type: application/json" \
58-
-d "{\"content\": \"❌ Acceptance tests failed\nSuite: ${ACC_PATTERN}\n<${CIRCLE_BUILD_URL}>\" }"\
59-
${DISCORD_WEBHOOK}
97+
- notify_slack_on_failure
6098
- go/save-cache:
6199
key: test_acc
62100
path: /home/circleci/.go_workspace/pkg/mod
@@ -237,6 +275,7 @@ workflows:
237275
# - TestAcc_Github_
238276
context:
239277
- driftctl-acc
278+
- snyk-bot-slack
240279
triggers:
241280
- schedule:
242281
cron: "0 3 * * *"
@@ -262,6 +301,7 @@ workflows:
262301
# - TestAcc_Github_
263302
context:
264303
- driftctl-acc
304+
- snyk-bot-slack
265305
pullrequest:
266306
jobs:
267307
- lint:

0 commit comments

Comments
 (0)