forked from sagarv26/IdentityIQ-SSB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeploySubSet.sh
More file actions
140 lines (116 loc) · 3.87 KB
/
Copy pathDeploySubSet.sh
File metadata and controls
140 lines (116 loc) · 3.87 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
#########################################
### Script Variables ###
#########################################
# Network logon id (uid to authenitcate to svn and iiq)
unfiUID=""
# Subversion password
svnPwd=""
# SailPoint IdentityIQ password
iiqPwd=""
# Build tag
iiqTag="trunk"
# Identify tomcat root
if [ "$HOSTNAME" = eplnx361 ] ||
[ "$HOSTNAME" = wplnx623 ] ; then
#echo "IIQ Development Server"
TOMCAT_ROOT='/opt/tomcat/8.5.14'
elif [ "$HOSTNAME" = eplnx362 ] ||
[ "$HOSTNAME" = eplnx363 ] ||
[ "$HOSTNAME" = wplnx624 ] ||
[ "$HOSTNAME" = wplnx625 ] ; then
#echo "IIQ QA Server"
TOMCAT_ROOT='/opt/tomcat/8.5.14'
elif [ "$HOSTNAME" = eplnx406 ] ||
[ "$HOSTNAME" = eplnx407 ] ||
[ "$HOSTNAME" = eplnx417 ] ||
[ "$HOSTNAME" = eplnx420 ] ||
[ "$HOSTNAME" = wplnx650 ] ||
[ "$HOSTNAME" = wplnx651 ] ||
[ "$HOSTNAME" = wplnx654 ] ||
[ "$HOSTNAME" = wplnx657 ] ; then
#echo "IIQ UAT Server"
TOMCAT_ROOT='/opt/tomcat/7.0.61'
elif [ "$HOSTNAME" = eplnx408 ] ||
[ "$HOSTNAME" = eplnx409 ] ||
[ "$HOSTNAME" = eplnx418 ] ||
[ "$HOSTNAME" = eplnx419 ] ||
[ "$HOSTNAME" = wplnx652 ] ||
[ "$HOSTNAME" = wplnx653 ] ||
[ "$HOSTNAME" = wplnx655 ] ||
[ "$HOSTNAME" = wplnx656 ] ; then
#echo "IIQ Prodution Server"
TOMCAT_ROOT='/opt/tomcat/7.0.61'
else
#echo "Unknown server"
printf "Script running on unknown server '$HOSTNAME', exiting...\n"
exit
fi
#########################################
### Start of Script ###
#########################################
# Prompt user for values if any variables are empty
if [ -z "$unfiUID" ]; then
read -p "Enter UID: " unfiUID
fi
if [ -z "$svnPwd" ]; then
read -sp "Enter SVN Password: " svnPwd
printf "\n"
fi
if [ -z "$iiqPwd" ]; then
read -sp "Enger IIQ Password: " iiqPwd
printf "\n"
fi
if [ -z "$iiqTag" ]; then
read -p "Enter TAG:" iiqTag
fi
if [ $iiqTag == "trunk" ]; then
url="http://sdedaps0286.devsvuent.supervalu.com/svn/SailpointCodeRepo/trunk"
else
url="http://sdedaps0286.devsvuent.supervalu.com/svn/SailpointCodeRepo/tag/$iiqTag"
fi
# set java variables
source $TOMCAT_ROOT/tomcatprofile
# checkout tagged build to tmp directory
cd /tmp
svn checkout --username $unfiUID --password $svnPwd --non-interactive $url
# give execute writes to build script and ant binary
chmod ug+x /tmp/$iiqTag/build.sh
chmod ug+x /tmp/$iiqTag/lib/ant/bin/ant
# execute build script
cd /tmp/$iiqTag
/tmp/$iiqTag/build.sh clean war
# check before deploying build
while true; do
read -p "Finished building war, proceed with deployment? " yn
case $yn in
[Yy]* ) buildCheck=true; break;;
[Nn]* ) buildCheck=false; break;;
* ) echo "Please answer yes or no.";;
esac
done
if [ $buildCheck == true ]; then
# remove WEB-INF/config folder from deployed application
echo "Overwriting WEB-INF/config..."
rsync -a --delete /tmp/$iiqTag/build/subset/WEB-INF/config $TOMCAT_ROOT/webapps/identityiq/WEB-INF/
# import subset configuration from application console
echo "Importing subset configuration at application console..."
chmod a+x $TOMCAT_ROOT/webapps/identityiq/WEB-INF/bin/iiq
echo 'import sp.init-custom.xml' > /tmp/commands.txt
$TOMCAT_ROOT/webapps/identityiq/WEB-INF/bin/iiq console iiqBeans -u $unfiUID -p $iiqPwd < /tmp/commands.txt
# cleanup
echo "Removing temporary files needed for build process..."
rm -f /tmp/commands.txt
else
printf "Skipping build...\n"
fi
# check for cleanup
while true; do
read -p "Finished deploying new configuration, cleanup files at /tmp/$iiqTag? " yn
case $yn in
[Yy]* ) echo "Removing /tmp/$iiqTag..."; rm -rf /tmp/$iiqTag; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
echo -e "\033[32mBuild complete.\033[0;39m\n"