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
86+ customProvisionServer=$( customProvisionServer)
87+ if [ " 0" = " ${customProvisionServer} " ]; then
88+ echo " Building application and provisioning server image..."
89+ mvn -B package -Popenshift wildfly:image -DskipTests
8790
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}
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}
96+ else
97+ provisionServer " ${application} " " ${qs_dir} "
98+ fi
9399
94100# ###############################################################################################
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} "
97101
98- additional_arguments=" No additional arguments"
99- if [ -n " ${helm_set_arguments} " ]; then
100- additional_arguments=" Additional arguments: ${helm_set_arguments} "
102+ customDeploy=$( customDeploy)
103+ if [ " 0" = " ${customDeploy} " ]; then
104+ # Helm install, waiting for the pods to come up
105+ 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} "
106+
107+ additional_arguments=" No additional arguments"
108+ if [ -n " ${helm_set_arguments} " ]; then
109+ additional_arguments=" Additional arguments: ${helm_set_arguments} "
110+ fi
111+
112+ echo " Performing Helm install and waiting for completion.... (${additional_arguments} )"
113+ # helmInstall is from overridable-functions.sh
114+ helm_install_ret=$( helmInstall " ${application} " " ${helm_set_arguments} " )
115+
116+ # For some reason the above sometimes becomes a multi-line string. actual The exit code will be
117+ # on the last line
118+ helm_install_ret=$( echo " ${helm_install_ret} " | tail -n 1)
119+
120+ echo " ret: ${helm_install_ret} "
121+ if [ " ${helm_install_ret} " != " 0" ]; then
122+ echo " Helm install failed!"
123+ echo " Dumping the application pod(s)"
124+ kubectl logs deployment/" ${application} "
125+ helmInstallFailed
126+ fi
127+ else
128+ deploy
101129fi
102130
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)
110-
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
131+ customPortForward=$( customPortForward)
132+ if [ " 0" = " ${customPortForward} " ]; then
133+ nohup kubectl port-forward service/${application} 8080:8080 > /dev/null 2>&1 &
134+ kubectl_fwd_pids=$!
135+ echo " Process ID of kubect port-forward: ${kubectl_fwd_pids} "
136+ else
137+ echo " Performing Port Forward and waiting for completion...."
138+ kubectl_fwd_pids=$( portForward " ${application} " )
139+ echo " Process ID(s) of kubect port-forward: ${kubectl_fwd_pids} "
117140fi
118141
119- kubectl port-forward service/${application} 8080:8080 &
120- kubectl_fwd_pid=$!
121- echo " Process ID of kubect port-forward: ${kubectl_fwd_pid} "
122-
123142# ###############################################################################################
124143# Run any post install
125144echo " Running post Helm install commands in $( pwd) "
@@ -130,35 +149,47 @@ runPostHelmInstallCommands
130149echo " running the tests"
131150pwd
132151
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
152+ customRunningTests=$( customRunningTests)
153+ if [ " 0" = " ${customRunningTests} " ]; then
154+ route=" localhost:8080"
155+
156+ mvnVerifyArguments=" -Dserver.host=${server_protocol} ://${route} "
157+ extraMvnVerifyArguments=" $( getMvnVerifyExtraArguments) "
158+ if [ -n " ${extraMvnVerifyArguments} " ]; then
159+ mvnVerifyArguments=" ${mvnVerifyArguments} ${extraMvnVerifyArguments} "
160+ fi
161+ if [ " ${QS_DEBUG_TESTS} " = " 1" ]; then
162+ mvnVerifyArguments=" ${mvnVerifyArguments} -Dmaven.failsafe.debug=true"
163+ fi
164+
165+ echo " Verify Arguments: ${mvnVerifyArguments} "
166+
167+ mvn -B verify -Pintegration-testing ${mvnVerifyArguments}
168+
169+ if [ " $? " != " 0" ]; then
170+ test_status=1
171+ echo " Tests failed!"
172+ echo " Dumping the application pod(s)"
173+ kubectl logs deployment/" ${application} "
174+ testsFailed
175+ fi
176+ else
177+ runningTests " ${application} " " ${server_protocol} " " $( getMvnVerifyExtraArguments) "
178+ test_status=$?
154179fi
155180
156- kill -9 ${kubectl_fwd_pid }
181+ kill -9 ${kubectl_fwd_pids }
157182
158183# ###############################################################################################
159184# Helm uninstall
160185echo " Running Helm uninstall"
161- helm uninstall " ${application} " --wait --timeout=10m0s
186+
187+ customHelmUninstall=$( customHelmUninstall)
188+ if [ " 0" = " ${customHelmUninstall} " ]; then
189+ helm uninstall " ${application} " --wait --timeout=10m0s
190+ else
191+ helmUninstall " ${application} "
192+ fi
162193
163194# ###############################################################################################
164195# Clean pre-requisites (cleanPrerequisites is fromm overridable-functions.sh)
0 commit comments