X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;f=jjb%2Fcloud-infra%2Fdelete-heat-stack.sh;h=efec47b77b0af7f076304a79e25d4c9dec599618;hb=b2205c4e7fafbadc724db1da0c2c7c1e58370e9c;hp=b3239445c1461a2a9381344a81804cdb2e362fb4;hpb=47f64a780d05ee8df09662435c562d9bc4362da2;p=infra%2Fcicd.git diff --git a/jjb/cloud-infra/delete-heat-stack.sh b/jjb/cloud-infra/delete-heat-stack.sh index b3239445..efec47b7 100644 --- 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 -# we don't support OpenStack scenario verification on OpenStack yet -if [[ "$DEPLOY_SCENARIO" =~ "os-" ]] && [[ "$PROVISIONER_TYPE" == "heat" ]]; then +# do not delete the stack if not explicitly set to delete +if [[ "$DELETE_STACK" != "yes" ]]; then echo "-------------------------------------------------------------------------" - echo "Info: OpenStack scenario verification on OpenStack has not been implemented yet!" + echo "Info: Stack will not be deleted upon the completion of the job!" 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 "Info: Stack will not be deleted upon the completion of the job!" + echo "Info: Nothing to delete!" 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 -echo "Info: Deleting stack $STACK_NAME" +echo "Info: Deleting stack $STACK_NAME and keypair $KEYPAIR_NAME" echo "-------------------------------------------------------------------------" source /tmp/openrc && /bin/rm -f /tmp/openrc openstack stack delete $STACK_NAME --wait --yes +openstack keypair delete $KEYPAIR_NAME 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: