Allow skipping destroy cluster 11/3311/2
authorYolanda Robla <yroblamo@redhat.com>
Tue, 31 Mar 2020 07:58:17 +0000 (09:58 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Tue, 31 Mar 2020 08:03:50 +0000 (10:03 +0200)
Destroy the cluster only if PRESERVE_CLUSTER is not set

Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
Change-Id: I22f87c83c0d04c8e82d15fa57ca62e24be752260

ci/kni_deploy_aws.sh
ci/kni_deploy_baremetal.sh
ci/kni_deploy_gcp.sh

index 07a7d70..3f5ea9c 100755 (executable)
@@ -67,9 +67,11 @@ if [ $STATUS -ne 0 ]; then
     exit 1
 fi
 
-echo "Workloads successfully applied! Starting cleanup"
-$HOME/.kni/${SITE_NAME}/requirements/openshift-install destroy cluster --dir=/$HOME/.kni/${SITE_NAME}/final_manifests 2>&1 | tee ${WORKSPACE}/aws_destroy.log
-STATUS=$?
+if [ -z "${PRESERVE_CLUSTER}" ]; then
+  echo "Workloads successfully applied! Starting cleanup"
+  $HOME/.kni/${SITE_NAME}/requirements/openshift-install destroy cluster --dir=/$HOME/.kni/${SITE_NAME}/final_manifests 2>&1 | tee ${WORKSPACE}/aws_destroy.log
+  STATUS=$?
+fi
 
 popd
 
index ad7544e..8983d40 100755 (executable)
@@ -74,7 +74,9 @@ if [ $STATUS -ne 0 ]; then
     exit 1
 fi
 
-# now destroy the cluster
-pushd $HOME/go/src/gerrit.akraino.org/kni/installer
-./knictl destroy_cluster $SITE_NAME
-popd
+if [ -z "${PRESERVE_CLUSTER}" ]; then
+  # now destroy the cluster
+  pushd $HOME/go/src/gerrit.akraino.org/kni/installer
+  ./knictl destroy_cluster $SITE_NAME
+  popd
+fi
index ac93c31..213e810 100755 (executable)
@@ -67,9 +67,11 @@ if [ $STATUS -ne 0 ]; then
     exit 1
 fi
 
-echo "Workloads successfully applied! Starting cleanup"
-$HOME/.kni/${SITE_NAME}/requirements/openshift-install destroy cluster --dir=/$HOME/.kni/${SITE_NAME}/final_manifests 2>&1 | tee ${WORKSPACE}/gcp_destroy.log
-STATUS=$?
+if [ -z "${PRESERVE_CLUSTER}" ]; then
+  echo "Workloads successfully applied! Starting cleanup"
+  $HOME/.kni/${SITE_NAME}/requirements/openshift-install destroy cluster --dir=/$HOME/.kni/${SITE_NAME}/final_manifests 2>&1 | tee ${WORKSPACE}/gcp_destroy.log
+  STATUS=$?
+fi
 
 popd