Destroy the cluster only if PRESERVE_CLUSTER is not set
Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
Change-Id: I22f87c83c0d04c8e82d15fa57ca62e24be752260
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
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
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