7676
7777# ###############################################################################################
7878# Install any pre-requisites. Function is from overridable-functions.sh
79+
7980echo " Checking if we need to install pre-requisites"
8081installPrerequisites " ${application} "
8182
8283# ###############################################################################################
8384# Provision server and push imagestream
8485
85- echo " Building application and provisioning server image..."
86- mvn -B package -Popenshift wildfly:image -DskipTests
87-
88- echo " Tagging image and pushing to registry..."
89- export root_image_name=" localhost:5000/${application} "
90- export image=" ${root_image_name} :latest"
91- docker tag ${qs_dir} ${image}
92- docker push ${image}
86+ customProvisionServer=$( customProvisionServer)
87+ if [ " 0" = " ${customProvisionServer} " ]; then
88+ echo " Building application and provisioning server image..."
89+ mvn -B package -Popenshift wildfly:image -DskipTests
9390
94- # ###############################################################################################
95- # Helm install, waiting for the pods to come up
96- helm_set_arguments=" --set ${helm_set_arg_prefix} build.enabled=false --set ${helm_set_arg_prefix} deploy.route.enabled=false --set ${helm_set_arg_prefix} image.name=${root_image_name} "
91+ echo " Tagging image and pushing to registry..."
92+ export root_image_name=" localhost:5000/${application} "
93+ export image=" ${root_image_name} :latest"
94+ docker tag ${qs_dir} ${image}
95+ docker push ${image}
9796
98- additional_arguments=" No additional arguments"
99- if [ -n " ${helm_set_arguments} " ]; then
100- additional_arguments=" Additional arguments: ${helm_set_arguments} "
97+ echo " Creating docker file locally and pushing to registry at localhost:5000"
98+ docker build -t " ${image} " target
99+ else
100+ provisionServer " ${application} " " ${qs_dir} "
101101fi
102102
103- echo " Performing Helm install and waiting for completion.... (${additional_arguments} )"
104- # helmInstall is from overridable-functions.sh
105- helm_install_ret=$( helmInstall " ${application} " " ${helm_set_arguments} " )
106-
107- # For some reason the above sometimes becomes a multi-line string. actual The exit code will be
108- # on the last line
109- helm_install_ret=$( echo " ${helm_install_ret} " | tail -n 1)
103+ # ###############################################################################################
110104
111- echo " ret: ${helm_install_ret} "
112- if [ " ${helm_install_ret} " != " 0" ]; then
113- echo " Helm install failed!"
114- echo " Dumping the application pod(s)"
115- kubectl logs deployment/" ${application} "
116- helmInstallFailed
105+ customDeploy=$( customDeploy)
106+ if [ " 0" = " ${customDeploy} " ]; then
107+ # Helm install, waiting for the pods to come up
108+ helm_set_arguments=" --set ${helm_set_arg_prefix} build.enabled=false --set ${helm_set_arg_prefix} deploy.route.enabled=false --set ${helm_set_arg_prefix} image.name=${root_image_name} "
109+
110+ additional_arguments=" No additional arguments"
111+ if [ -n " ${helm_set_arguments} " ]; then
112+ additional_arguments=" Additional arguments: ${helm_set_arguments} "
113+ fi
114+
115+ echo " Performing Helm install and waiting for completion.... (${additional_arguments} )"
116+ # helmInstall is from overridable-functions.sh
117+ helm_install_ret=$( helmInstall " ${application} " " ${helm_set_arguments} " )
118+
119+ # For some reason the above sometimes becomes a multi-line string. actual The exit code will be
120+ # on the last line
121+ helm_install_ret=$( echo " ${helm_install_ret} " | tail -n 1)
122+
123+ echo " ret: ${helm_install_ret} "
124+ if [ " ${helm_install_ret} " != " 0" ]; then
125+ echo " Helm install failed!"
126+ echo " Dumping the application pod(s)"
127+ kubectl logs deployment/" ${application} "
128+ helmInstallFailed
129+ fi
130+ else
131+ deploy
117132fi
118133
119- kubectl port-forward service/${application} 8080:8080 &
120- kubectl_fwd_pid=$!
121- echo " Process ID of kubect port-forward: ${kubectl_fwd_pid} "
134+ customPortForward=$( customPortForward)
135+ if [ " 0" = " ${customPortForward} " ]; then
136+ nohup kubectl port-forward service/${application} 8080:8080 > /dev/null 2>&1 &
137+ kubectl_fwd_pids=$!
138+ echo " Process ID of kubect port-forward: ${kubectl_fwd_pids} "
139+ else
140+ echo " Performing Port Forward and waiting for completion...."
141+ kubectl_fwd_pids=$( portForward " ${application} " )
142+ echo " Process ID(s) of kubect port-forward: ${kubectl_fwd_pids} "
143+ fi
122144
123145# ###############################################################################################
124146# Run any post install
@@ -130,35 +152,47 @@ runPostHelmInstallCommands
130152echo " running the tests"
131153pwd
132154
133- route=" localhost:8080"
134-
135- mvnVerifyArguments=" -Dserver.host=${server_protocol} ://${route} "
136- extraMvnVerifyArguments=" $( getMvnVerifyExtraArguments) "
137- if [ -n " ${extraMvnVerifyArguments} " ]; then
138- mvnVerifyArguments=" ${mvnVerifyArguments} ${extraMvnVerifyArguments} "
139- fi
140- if [ " ${QS_DEBUG_TESTS} " = " 1" ]; then
141- mvnVerifyArguments=" ${mvnVerifyArguments} -Dmaven.failsafe.debug=true"
142- fi
143-
144- echo " Verify Arguments: ${mvnVerifyArguments} "
145-
146- mvn -B verify -Pintegration-testing ${mvnVerifyArguments}
147-
148- if [ " $? " != " 0" ]; then
149- test_status=1
150- echo " Tests failed!"
151- echo " Dumping the application pod(s)"
152- kubectl logs deployment/" ${application} "
153- testsFailed
155+ customRunningTests=$( customRunningTests)
156+ if [ " 0" = " ${customRunningTests} " ]; then
157+ route=" localhost:8080"
158+
159+ mvnVerifyArguments=" -Dserver.host=${server_protocol} ://${route} "
160+ extraMvnVerifyArguments=" $( getMvnVerifyExtraArguments) "
161+ if [ -n " ${extraMvnVerifyArguments} " ]; then
162+ mvnVerifyArguments=" ${mvnVerifyArguments} ${extraMvnVerifyArguments} "
163+ fi
164+ if [ " ${QS_DEBUG_TESTS} " = " 1" ]; then
165+ mvnVerifyArguments=" ${mvnVerifyArguments} -Dmaven.failsafe.debug=true"
166+ fi
167+
168+ echo " Verify Arguments: ${mvnVerifyArguments} "
169+
170+ mvn -B verify -Pintegration-testing ${mvnVerifyArguments}
171+
172+ if [ " $? " != " 0" ]; then
173+ test_status=1
174+ echo " Tests failed!"
175+ echo " Dumping the application pod(s)"
176+ kubectl logs deployment/" ${application} "
177+ testsFailed
178+ fi
179+ else
180+ runningTests " ${application} " " ${server_protocol} " " $( getMvnVerifyExtraArguments) "
181+ test_status=$?
154182fi
155183
156- kill -9 ${kubectl_fwd_pid }
184+ kill -9 ${kubectl_fwd_pids }
157185
158186# ###############################################################################################
159187# Helm uninstall
160188echo " Running Helm uninstall"
161- helm uninstall " ${application} " --wait --timeout=10m0s
189+
190+ customHelmUninstall=$( customHelmUninstall)
191+ if [ " 0" = " ${customHelmUninstall} " ]; then
192+ helm uninstall " ${application} " --wait --timeout=10m0s
193+ else
194+ helmUninstall " ${application} "
195+ fi
162196
163197# ###############################################################################################
164198# Clean pre-requisites (cleanPrerequisites is fromm overridable-functions.sh)
0 commit comments