forked from Flink/dokku-airbrake-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-deploy
executable file
·26 lines (24 loc) · 1.02 KB
/
post-deploy
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
#!/usr/bin/env bash
source "$(dirname $0)/../dokku_common"
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
set +e
APP="$1"
APP_ROOT="$DOKKU_ROOT/$APP"
API_KEY=$(dokku config:get "$APP" AIRBRAKE_API_KEY)
if [[ $API_KEY ]]; then
cd $APP_ROOT
REPO_URL=$(dokku config:get "$APP" AIRBRAKE_REPO_URL || echo "dokku@$(cat $DOKKU_ROOT/VHOST):$APP")
BASE_URL=$(dokku config:get "$APP" AIRBRAKE_HOST || echo 'https://airbrake.io')
RAILS_ENV=$(dokku config:get "$APP" RACK_ENV || dokku config:get "$APP" RAILS_ENV || echo 'production')
GIT_REV=$(git log -n1 --pretty='format:%H' 2> /dev/null || printf '0%.0s' {1..41})
GIT_MESSAGE=$(git log -n1 --pretty='format:%s' 2> /dev/null || echo '')
# info "Notifying airbrake..."
curl "$BASE_URL/deploys.txt" --silent \
--data "api_key=$API_KEY" \
--data "deploy[local_username]=Dokku" \
--data "deploy[rails_env]=$RAILS_ENV" \
--data "deploy[scm_repository]=$REPO_URL" \
--data "deploy[scm_revision]=$GIT_REV" \
--data "deploy[message]=$GIT_MESSAGE" > /dev/null
exit 0
fi