Skip to content

Commit 89fd81d

Browse files
authored
Merge pull request #86 from SiftScience/CI-10268-build-failure
Updating the slack notification and fixed the workflow for circleci failures
2 parents 4df8f3b + 9a3ae14 commit 89fd81d

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

.circleci/config.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
1-
version: 2
1+
version: 2.1
2+
3+
orbs:
4+
slack: circleci/slack@4.1
5+
6+
slack/notify: &slack_notify
7+
branch_pattern: master
8+
event: fail
9+
channel: ci-build-status
10+
template: SLACK_TAG_CI_FAILURE_TEMPLATE
11+
12+
commands:
13+
export_slack_id:
14+
steps:
15+
- run:
16+
name : Exporting circleci username as slack id.
17+
command: echo 'export SLACK_PARAM_MENTIONS="$CIRCLE_USERNAME"' >> "$BASH_ENV"
18+
- run:
19+
name : CircleCi To Slack user mapping.
20+
command: |
21+
echo $GITHUB_SLACK_USERMAPPING | base64 --decode > github_slack
22+
while read -r line || [[ -n $line ]];
23+
do
24+
[[ ${line//[[:space:]]/} =~ ^#.* || -z "$line" ]] && continue
25+
echo "$line" | tr "=" "\n" | while read -r key; do
26+
read -r value
27+
if [ "$CIRCLE_USERNAME" = "${key}" ]; then
28+
echo "export SLACK_PARAM_MENTIONS='<@${value}>'" >> $BASH_ENV
29+
fi
30+
done
31+
done < github_slack
32+
rm github_slack
233
334
jobs:
435
build:
@@ -13,7 +44,7 @@ jobs:
1344

1445
steps:
1546
- checkout
16-
47+
- export_slack_id
1748
- restore_cache:
1849
keys:
1950
- v1-dependencies-{{ checksum "build.gradle" }}
@@ -27,3 +58,15 @@ jobs:
2758
key: v1-dependencies-{{ checksum "build.gradle" }}
2859

2960
- run: ./gradlew test
61+
62+
- slack/notify:
63+
<<: *slack_notify
64+
65+
workflows:
66+
sift-java:
67+
jobs:
68+
- build:
69+
context:
70+
- slack-templates
71+
- slack_Oauth
72+
- Github_Slack_UserMapping

0 commit comments

Comments
 (0)