Code Review
/
infra
/
cicd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
engine: Avoid using dots in job streams
[infra/cicd.git]
/
jjb
/
cloud-infra
/
delete-heat-stack.sh
diff --git
a/jjb/cloud-infra/delete-heat-stack.sh
b/jjb/cloud-infra/delete-heat-stack.sh
index 41d522aaa8de41f702ea96ed30235232bb14ff40..efec47b77b0af7f076304a79e25d4c9dec599618 100644
(file)
--- a/
jjb/cloud-infra/delete-heat-stack.sh
+++ b/
jjb/cloud-infra/delete-heat-stack.sh
@@
-29,17
+29,18
@@
if [[ $DEPLOY_TYPE != "cloud" ]]; then
exit 0
fi
exit 0
fi
-#
we only support k8s scenario deployment on openstack as of now
-if [[ "$DE
PLOY_SCENARIO" != "k8-*" ]] && [[ "$PROVISIONER_TYPE" == "heat
" ]]; then
+#
do not delete the stack if not explicitly set to delete
+if [[ "$DE
LETE_STACK" != "yes
" ]]; then
echo "-------------------------------------------------------------------------"
echo "-------------------------------------------------------------------------"
- echo "Info:
Only k8s scenario deployment on OpenStack has been implemented
!"
+ echo "Info:
Stack will not be deleted upon the completion of the job
!"
echo "-------------------------------------------------------------------------"
exit 0
fi
echo "-------------------------------------------------------------------------"
exit 0
fi
-if [[ "$DELETE_STACK" != "yes" ]]; then
+# k8s and onap scenario have stacks so exit for others
+if [[ ! "$DEPLOY_SCENARIO" =~ ^k8-.*|^onap-.* ]]; then
echo "-------------------------------------------------------------------------"
echo "-------------------------------------------------------------------------"
- echo "Info:
Stack will not be deleted upon the completion of the job
!"
+ echo "Info:
Nothing to delete
!"
echo "-------------------------------------------------------------------------"
exit 0
fi
echo "-------------------------------------------------------------------------"
exit 0
fi
@@
-59,11
+60,12
@@
set +u
source $WORKSPACE/.venv/bin/activate
set -u
pip install -q openstacksdk python-openstackclient python-heatclient
source $WORKSPACE/.venv/bin/activate
set -u
pip install -q openstacksdk python-openstackclient python-heatclient
-echo "Info: Deleting stack $STACK_NAME"
+echo "Info: Deleting stack $STACK_NAME
and keypair $KEYPAIR_NAME
"
echo "-------------------------------------------------------------------------"
echo "-------------------------------------------------------------------------"
-source /tmp/openrc &&
sudo
/bin/rm -f /tmp/openrc
+source /tmp/openrc && /bin/rm -f /tmp/openrc
openstack stack delete $STACK_NAME --wait --yes
openstack stack delete $STACK_NAME --wait --yes
+openstack keypair delete $KEYPAIR_NAME
echo "-------------------------------------------------------------------------"
echo "-------------------------------------------------------------------------"
-echo "Info: Stack $STACK_NAME
has
been deleted!"
+echo "Info: Stack $STACK_NAME
and keypair $KEYPAIR_NAME have
been deleted!"
# vim: set ts=2 sw=2 expandtab:
# vim: set ts=2 sw=2 expandtab: