From de7be2a904451041cfb8ee22a30b44796c5784ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Wed, 8 Mar 2023 15:44:16 +0100 Subject: [PATCH] Remove potential stale ports before cleaning subnet The proxy and az jobs create resources that may not be cleaned up upon job completion. One such example was seen in https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/periodic-ci-shiftstack-shiftstack-ci-main-periodic-4.13-e2e-openstack-az/1632828398344605696 where the leftover port on the proxy machine subnet caused the cleanup script to fail. --- clean-ci-resources.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clean-ci-resources.sh b/clean-ci-resources.sh index d536e65..d885f07 100755 --- a/clean-ci-resources.sh +++ b/clean-ci-resources.sh @@ -120,6 +120,17 @@ for resource in 'loadbalancer' 'server' 'router' 'subnet' 'network' 'volume snap echo "$r" | report $resource | xargs --verbose openstack $resource delete done ;; + subnet) + for r in $(./stale.sh -q "$resource"); do + network=$(openstack subnet show "$r" -c network_id -f value) + ports=$(openstack port list --network "$network" -f value -c id) + for port in $ports; do + echo "$port" | report port | xargs --verbose openstack port delete + done + # shellcheck disable=SC2086 + echo "$r" | report $resource | xargs --verbose openstack $resource delete + done + ;; *) # shellcheck disable=SC2086 ./stale.sh -q $resource | report $resource | xargs --verbose --no-run-if-empty openstack $resource delete