-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhook-handler
executable file
·42 lines (34 loc) · 923 Bytes
/
hook-handler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
APP="$1"; IMAGE="dokku/$APP"; CACHE_DIR="$DOKKU_ROOT/$APP/cache"
source "$(dirname $0)/../common/functions"
CONFIG="$DOKKU_ROOT/$APP/hipchat.conf";
source "$PLUGIN_PATH/hipchat/hipchat_dokku_functions"
[[ $(hipchat_is_enabled) == "false" ]] && dokku_log_info1 "HipChat: Notification isn't enabled for $APP." && exit 0
# config file exists, so we can do this at this point.
source $CONFIG
dokku_log_info1 "HipChat: hook-handler called for $0 $1 $2 $3"
HOOK=$(basename $0)
# TODO: Add configurable messages.
case "$HOOK" in
pre-deploy)
handle_hook $HOOK
;;
check-deploy)
handle_hook $HOOK
;;
post-deploy)
handle_hook $HOOK
;;
pre-build)
handle_hook $HOOK
;;
post-build)
handle_hook $HOOK
;;
*)
MSG="$0 $1 $2 $3 $4 $5"
dokku hipchat:send_message $APP "$MSG"
;;
esac
dokku_log_info1 "HipChat: hook-handler complete."