File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -59,10 +59,34 @@ jobs:
59
59
- name : Delete CI clusters
60
60
run : |
61
61
. venv/bin/activate
62
- if [[ -z " ${ci_clusters}" ]]; then
62
+ if [[ -z ${ci_clusters} ]]; then
63
63
echo "No clusters to delete."
64
64
exit 0
65
65
fi
66
- echo "Deleting clusters: ${ci_clusters}"
67
- ./dev/delete-cluster.py ${ci_clusters} --force
66
+
67
+ for cluster_prefix in ${ci_clusters}
68
+ do
69
+ echo "Processing cluster: $cluster_prefix"
70
+
71
+ # Get all servers with the matching name for control node
72
+ CONTROL_SERVERS=$(openstack server list --name ${cluster_prefix}-control --format json)
73
+
74
+ # Get unique server names to avoid duplicate cleanup
75
+ UNIQUE_NAMES=$(echo "$CONTROL_SERVERS" | jq -r '.[].Name' | sort | uniq)
76
+ for name in $UNIQUE_NAMES; do
77
+ echo "Deleting cluster with control node: $name"
78
+
79
+ # Get the first matching server ID by name
80
+ server=$(echo "$CONTROL_SERVERS" | jq -r '.[] | select(.Name=="'"$name"'") | .ID' | head -n1)
81
+
82
+ # Make sure server still exists (wasn't deleted earlier)
83
+ if ! openstack server show "$server" &>/dev/null; then
84
+ echo "Server $server no longer exists, skipping $name."
85
+ continue
86
+ fi
87
+
88
+ echo "Deleting cluster $cluster_prefix (server $server)..."
89
+ ./dev/delete-cluster.py $cluster_prefix --force
90
+ done
91
+ done
68
92
shell : bash
You can’t perform that action at this time.
0 commit comments