Skip to content

Commit e0de86f

Browse files
committed
[ci] Added trigger to ui repo on successful deploy
1 parent fb4eec2 commit e0de86f

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

.circleci/config.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,37 @@ jobs:
134134
: ${CIRCLE_PROJECT_REPONAME?}
135135
136136
commit_upm.sh ~/upm
137+
138+
- run:
139+
name: Trigger zardan/ui build
140+
command: |
141+
set +o errexit
142+
set +o pipefail
143+
144+
: ${DEPLOY_STATUS:="fail"}
145+
: ${CIRCLE_API_KEY:=}
146+
: ${TRIGGER_UI_USER:="zardan"}
147+
: ${TRIGGER_UI_REPO:="ui"}
148+
: ${TRIGGER_UI_BRANCH:="develop"}
149+
150+
if [[ "$DEPLOY_STATUS" != "success" ]]
151+
then
152+
echo "Did not deploy. Do not trigger ui build."
153+
echo "TRIGGER_UI='idle'" >> $BASH_ENV
154+
elif ! [[ "$CIRCLE_API_KEY" ]]
155+
then
156+
echo "No CircleCI API key. Can not trigger build."
157+
echo "TRIGGER_UI='fail'" >> $BASH_ENV
158+
else
159+
echo "Successfully deployed. Let's go trigger ui build."
160+
curl -X POST \
161+
--header "Content-Type: application/json" \
162+
--data "{
163+
\"branch\": \"$TRIGGER_UI_BRANCH\"
164+
}" https://circleci.com/api/v1.1/project/github/$TRIGGER_UI_USER/$TRIGGER_UI_REPO/build?circle-token=$CIRCLE_API_KEY
165+
166+
echo "TRIGGER_UI='success'" >> $BASH_ENV
167+
fi
137168
138169
- run:
139170
command: |

scripts/slack_notify_github_deploy.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
: ${DEPLOY_TAG_COMBINED:=}
1212
: ${DEPLOY_CHANGESET:=}
1313
: ${BUILD_STATUS:="fail"}
14+
: ${TRIGGER_UI:="fail"}
1415

1516
if [ -z "$SLACK_WEBHOOK" ]; then
1617
echo "NO SLACK WEBHOOK SET"
@@ -99,6 +100,19 @@ then
99100
\"short\": true
100101
}"
101102

103+
if [[ "$TRIGGER_UI" == "success" ]]
104+
then
105+
fields="$fields,
106+
{
107+
\"value\": \"_:heavy_check_mark: Triggered Playground UI build._\"
108+
}"
109+
else
110+
fields="$fields,
111+
{
112+
\"value\": \"_:exclamation: Failed triggering Playground UI build. Visit job for more info._\"
113+
}"
114+
fi
115+
102116
if [[ "${GITHUB_USER_ID:-}" ]]
103117
then
104118
echo "Looking up commit author $GITHUB_USER_ID on github..."

scripts/slack_notify_testrunner.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ then
216216
echo "Job completed successfully. Alert sent."
217217
else
218218
echo "Something went wrong in the webhook..."
219+
echo "Response: $response"
219220
fi
220221

222+
echo
221223
echo "Payload:"
222224
echo
223225
echo "$data"

0 commit comments

Comments
 (0)