-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths-bot.sh
More file actions
executable file
·23 lines (19 loc) · 1.49 KB
/
s-bot.sh
File metadata and controls
executable file
·23 lines (19 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
#todo- parametarize all variables, create json object on the fly [https://stedolan.github.io/jq/].
webhook_url=""
CIRCLE_JOB="deploy-prod"
CIRCLE_PROJECT_REPONAME="CI-bot"
CIRCLE_BRANCH="master"
CIRCLE_TAG="1.0"
CIRCLE_USERNAME="sacOO7"
CIRCLE_BUILD_URL="https://circleci.com/gh/sacOO7/Pytest-BDD-Samples/3";
# error curl request
curl --header "Content-Type: application/json" \
--request POST \
--data "{\"cards\":[{\"header\":{\"title\":\"Oops. ${CIRCLE_JOB} failed.\",\"subtitle\":\"${CIRCLE_PROJECT_REPONAME}-${CIRCLE_BRANCH}\",\"imageUrl\":\"https://png.pngtree.com/svg/20170406/icon_failed__1325447.png\",\"imageStyle\":\"IMAGE\"},\"sections\":[{\"widgets\":[{\"keyValue\":{\"topLabel\":\"${CIRCLE_TAG}\",\"content\":\"Credits - ${CIRCLE_USERNAME}\"}}]},{\"widgets\":[{\"buttons\":[{\"textButton\":{\"text\":\"DETAILS\",\"onClick\":{\"openLink\":{\"url\":\"${CIRCLE_BUILD_URL}\"}}}}]}]}]}]}" \
"$webhook_url"
# success curl request
curl --header "Content-Type: application/json" \
--request POST \
--data "{\"cards\":[{\"header\":{\"title\":\"${CIRCLE_JOB} successful.\",\"subtitle\":\"${CIRCLE_PROJECT_REPONAME}-${CIRCLE_BRANCH}\",\"imageUrl\":\"https://png.pngtree.com/svg/20170510/success_404253.png\",\"imageStyle\":\"IMAGE\"},\"sections\":[{\"widgets\":[{\"keyValue\":{\"topLabel\":\"${CIRCLE_TAG}\",\"content\":\"Credits - ${CIRCLE_USERNAME}\"}}]},{\"widgets\":[{\"buttons\":[{\"textButton\":{\"text\":\"DETAILS\",\"onClick\":{\"openLink\":{\"url\":\"${CIRCLE_BUILD_URL}\"}}}}]}]}]}]}" \
"$webhook_url"