Skip to content

Commit f1fd75e

Browse files
authored
Update nightly-cleanup.yml
1 parent 9b1bf12 commit f1fd75e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/nightly-cleanup.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,20 @@ jobs:
6363
echo "No clusters to delete."
6464
exit 0
6565
fi
66-
66+
6767
for cluster_prefix in ${ci_clusters}
6868
do
6969
echo "Processing cluster: $cluster_prefix"
70-
TAGS=$(openstack server show ${cluster_prefix}-control --column tags --format value)
70+
# Get all servers with the matching name for control node
71+
CONTROL_SERVERS=$(openstack server list --name ${cluster_prefix}-control --format json)
72+
SERVER_COUNT=$(echo "$CONTROL_SERVERS" | jq length)
73+
74+
if [[ $SERVER_COUNT -gt 1 ]]; then
75+
echo "Warning: More than one server found for control node '${cluster_prefix}-control'."
76+
continue
77+
fi
78+
TAGS=$(echo "$CONTROL_SERVERS" | jq -r '.[0].Tags' )
79+
7180
if [[ $TAGS =~ "keep" ]]; then
7281
echo "Skipping ${cluster_prefix} - control instance is tagged as keep"
7382
else

0 commit comments

Comments
 (0)