-
Notifications
You must be signed in to change notification settings - Fork 5
/
continuous-integration.xml
177 lines (157 loc) · 7.74 KB
/
continuous-integration.xml
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0"?>
<project name="yanel-cruise-control" default="cruise-control" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>Yanel Build for Continuous Integration</description>
<!-- This is file is imported by ../../build.xml and hence resolved relative to ../../build.xml -->
<property file="targets/cruise-control/local.continuous-integration.properties"/>
<property file="targets/cruise-control/continuous-integration.properties"/>
<target name="cruise-control" description="Cruise control build process">
<echo>Cleaning Yanel</echo>
<antcall target="clean"/>
<echo>Deploying Yanel</echo>
<antcall target="deploy"/>
</target>
<target name="start-tomcat" description="starts tomcat">
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<antcall target="startup-tomcat-windows"/>
<antcall target="startup-tomcat-unix"/>
<waitfor maxwait="60" maxwaitunit="second" checkevery="4000">
<and>
<socket server="${tomcat.ip}" port="${tomcat.port}"/>
</and>
</waitfor>
<echo message="*****************************************************************"/>
<echo message="*"/>
<echo message="* You have successfully started Yanel ${yanel.version} (Revision ${yanel.revision})"/>
<echo message="*"/>
<echo message="*"/>
<echo message="* Start your Browser and visit"/>
<echo message="*"/>
<echo message="* http://127.0.0.1:8080/${servlet.context.prefix}/"/>
<echo message="*"/>
<echo message="* Thanks for using Yanel"/>
<echo message="*"/>
<echo message="*****************************************************************"/>
<available file="${document.root}/cruise_is_building.html" property="cruise_is_building_html_available"/>
<antcall target="delete-building-hint"/>
</target>
<target name="startup-tomcat-windows" if="isWindows">
<condition property="isTomcat1HomeSet">
<isset property="tomcat1.home.dir"/>
</condition>
<antcall target="startup-tomcat-windows-node1"/>
<condition property="isTomcat2HomeSet">
<isset property="tomcat2.home.dir"/>
</condition>
<antcall target="startup-tomcat-windows-node2"/>
</target>
<target name="startup-tomcat-unix" if="isUnix">
<fail message="No Tomcat is set inside local.build.properties! Please note that if you build Yanel from scratch, then you should use the 'quick-start' target (https://github.com/wyona/yanel).">
<condition>
<and>
<not>
<isset property="tomcat1.home.dir"/>
</not>
<not>
<isset property="tomcat2.home.dir"/>
</not>
</and>
</condition>
</fail>
<condition property="isTomcat1HomeSet">
<isset property="tomcat1.home.dir"/>
</condition>
<antcall target="startup-tomcat-unix-node1"/>
<condition property="isTomcat2HomeSet">
<isset property="tomcat2.home.dir"/>
</condition>
<antcall target="startup-tomcat-unix-node2"/>
</target>
<target name="startup-tomcat-windows-node1" if="isTomcat1HomeSet">
<echo>Startup Tomcat Cluster Node 1: ${tomcat1.home.dir}/bin/startup.bat</echo>
<!-- NOTE: Spawn is true because otherwise the batch script will not continue beyond this call (This is only necessary for Windows) -->
<exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="startup.bat" spawn="true"/>
</target>
<target name="startup-tomcat-unix-node1" if="isTomcat1HomeSet">
<echo>Starting Tomcat (${tomcat1.home.dir}/bin/startup.sh) ...</echo>
<chmod dir="${tomcat1.home.dir}/bin" perm="755" includes="*"/>
<exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="startup.sh" spawn="false"/>
</target>
<target name="startup-tomcat-windows-node2" if="isTomcat2HomeSet">
<echo>Startup Tomcat Cluster Node 2: ${tomcat2.home.dir}/bin/startup.bat</echo>
<!-- NOTE: Spawn is true because otherwise the batch script will not continue beyond this call (This is only necessary for Windows) -->
<exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="startup.bat" spawn="true"/>
</target>
<target name="startup-tomcat-unix-node2" if="isTomcat2HomeSet">
<echo>Starting Tomcat (${tomcat2.home.dir}/bin/startup.sh) ...</echo>
<chmod dir="${tomcat2.home.dir}/bin" perm="755" includes="*"/>
<exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="startup.sh" spawn="false"/>
</target>
<target name="stop-tomcat" description="stops tomcat">
<available file="${document.root}/cruise_is_building.html.orig" property="cruise_is_building_html_orig_available"/>
<antcall target="copy-building-hint"/>
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<antcall target="shutdown-tomcat-windows"/>
<antcall target="shutdown-tomcat-unix"/>
<echo message="*****************************************************************"/>
<echo message="*"/>
<echo message="* You have successfully stopped Yanel ${yanel.version} (Revision ${yanel.revision})"/>
<echo message="*"/>
<echo message="* Thanks for using Yanel"/>
<echo message="*"/>
<echo message="*****************************************************************"/>
</target>
<target name="shutdown-tomcat-windows" if="isWindows">
<echo>Windows ...</echo>
<condition property="isTomcat1HomeSet">
<isset property="tomcat1.home.dir"/>
</condition>
<antcall target="shutdown-tomcat-windows-node1"/>
<condition property="isTomcat2HomeSet">
<isset property="tomcat2.home.dir"/>
</condition>
<antcall target="shutdown-tomcat-windows-node2"/>
</target>
<target name="shutdown-tomcat-unix" if="isUnix">
<echo>Unix ...</echo>
<condition property="isTomcat1HomeSet">
<isset property="tomcat1.home.dir"/>
</condition>
<antcall target="shutdown-tomcat-unix-node1"/>
<condition property="isTomcat2HomeSet">
<isset property="tomcat2.home.dir"/>
</condition>
<antcall target="shutdown-tomcat-unix-node2"/>
</target>
<target name="shutdown-tomcat-windows-node1" if="isTomcat1HomeSet">
<exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="shutdown.bat" spawn="false"/>
</target>
<target name="shutdown-tomcat-unix-node1" if="isTomcat1HomeSet">
<echo>Shutdown Tomcat (${tomcat1.home.dir}/bin/shutdown.sh) ...</echo>
<chmod dir="${tomcat1.home.dir}/bin" perm="755" includes="*"/>
<exec dir="${tomcat1.home.dir}/bin" resolveexecutable="true" executable="shutdown.sh" spawn="false"/>
</target>
<target name="shutdown-tomcat-windows-node2" if="isTomcat2HomeSet">
<exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="shutdown.bat" spawn="false"/>
</target>
<target name="shutdown-tomcat-unix-node2" if="isTomcat2HomeSet">
<echo>Shutdown Tomcat (${tomcat2.home.dir}/bin/shutdown.sh) ...</echo>
<chmod dir="${tomcat2.home.dir}/bin" perm="755" includes="*"/>
<exec dir="${tomcat2.home.dir}/bin" resolveexecutable="true" executable="shutdown.sh" spawn="false"/>
</target>
<target name="copy-building-hint" if="cruise_is_building_html_orig_available" description="copy a message to the httpd saying yanel is stoped and building">
<copy file="${document.root}/cruise_is_building.html.orig" tofile="${document.root}/cruise_is_building.html"/>
</target>
<target name="delete-building-hint" if="cruise_is_building_html_available" description="removes the message from the httpd saying yanel is stoped and building">
<delete file="${document.root}/cruise_is_building.html"/>
</target>
</project>