File tree Expand file tree Collapse file tree 2 files changed +62
-4
lines changed
Expand file tree Collapse file tree 2 files changed +62
-4
lines changed Original file line number Diff line number Diff line change 11version : 2.1
22
3+
4+ init : &init
5+ run :
6+ name : init
7+ command : |
8+ echo '. .circleci/shared.bash' >> "$BASH_ENV"
9+ . .circleci/shared.bash
10+
311jobs :
412 build :
513 machine :
2028 working_directory : ~/codeclimate/codeclimate-sonar-java
2129 steps :
2230 - checkout
31+ - *init
2332 - run :
2433 name : Validate owner
2534 command : |
3645 docker tag codeclimate/codeclimate-sonar-java \
3746 us.gcr.io/code-climate/codeclimate-sonar-java:b$CIRCLE_BUILD_NUM
3847 docker push us.gcr.io/code-climate/codeclimate-sonar-java:b$CIRCLE_BUILD_NUM
48+ - run : send_webhook
3949
4050workflows :
4151 version : 2
@@ -48,7 +58,3 @@ workflows:
4858 filters :
4959 branches :
5060 only : /master|channel\/[\w-]+/
51-
52- notify :
53- webhooks :
54- - url : https://cc-slack-proxy.herokuapp.com/circle
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -exuo pipefail
4+
5+ function commiter_email() {
6+ set +x
7+ git log -n 1 --format=' %ae'
8+ set -x
9+ }
10+
11+ function webhook_payload() {
12+ set +x
13+ COMMITER_EMAIL=$( commiter_email)
14+ CURRENT_DATE=$( date)
15+ jq --null-input \
16+ --arg reponame $CIRCLE_PROJECT_REPONAME \
17+ --arg username $CIRCLE_PROJECT_USERNAME \
18+ --arg branch $CIRCLE_BRANCH \
19+ --arg build_num $CIRCLE_BUILD_NUM \
20+ --arg build_url $CIRCLE_BUILD_URL \
21+ --arg author_email $COMMITER_EMAIL \
22+ --arg end_time " $CURRENT_DATE " \
23+ ' {
24+ "payload": {
25+ "status": "success",
26+ "outcome":"success",
27+ "username": $username,
28+ "reponame": $reponame,
29+ "branch": $branch,
30+ "build_num": $build_num,
31+ "build_url": $build_url,
32+ "author_email": $author_email,
33+ "steps": [
34+ {
35+ "actions": [
36+ {"end_time": $end_time }
37+ ]
38+ }
39+ ]
40+ }
41+ }'
42+ set -x
43+ }
44+
45+ function send_webhook() {
46+ set +x
47+ PAYLOAD=$( webhook_payload)
48+ curl -i -X POST https://cc-slack-proxy.herokuapp.com/circle \
49+ -H ' Content-Type: application/json' \
50+ -d " $PAYLOAD "
51+ set -x
52+ }
You can’t perform that action at this time.
0 commit comments