forked from joestewart/aegir_cid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment.sh
executable file
·49 lines (40 loc) · 1.11 KB
/
deployment.sh
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
43
44
45
46
#!/bin/bash
#
# Wrapper script for our fabfile, to be called from Jenkins
#
# Where our fabfile is
FABFILE=/usr/local/bin/fabfile.py
HOST=$1
SITE=$2
PROFILE=$3
WEBSERVER=$4
DBSERVER=$5
PLATFORM=$6
BUILD_NUMBER=$7
DATE=`date +%Y%m%d%H%M%S`
if [[ -z $HOST ]] || [[ -z $SITE ]] || [[ -z $PROFILE ]] || [[ -z $WEBSERVER ]] || [[ -z $DBSERVER ]] || [[ -z $PLATFORM ]] || [[ -z $BUILD_NUMBER ]]
then
echo "Missing args! Exiting"
exit 1
fi
# Array of tasks - these are actually functions in the fabfile, as an array here for the sake of abstraction
if [ $BUILD_NUMBER -eq "1" ]; then
# This is a first-time ever build. Let's install a site instead of migrate it
TASKS=(
fetch_platform
save_alias
install_site
)
else
TASKS=(
fetch_platform
migrate_site
save_alias
import_site
)
fi
# Loop over each 'task' and call it as a function via the fabfile,
# with some extra arguments which are sent to this shell script by Jenkins
for task in ${TASKS[@]}; do
fab -f $FABFILE -H $HOST $task:site=$SITE,profile=$PROFILE,webserver=$WEBSERVER,dbserver=$DBSERVER,platform=$PLATFORM,build=$DATE || exit 1
done