Skip to content

Commit 2244f07

Browse files
authored
Merge pull request #653 from stackhpc/fix/nightly-cleanup
fix nightly cleanup for duplicate server names
2 parents 4efb739 + 8da423b commit 2244f07

File tree

1 file changed

+4
-33
lines changed

1 file changed

+4
-33
lines changed

.github/workflows/nightly-cleanup.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,13 @@ jobs:
5656
fi
5757
shell: bash
5858

59-
- name: Delete clusters if control node not tagged with keep
59+
- name: Delete CI clusters
6060
run: |
6161
. venv/bin/activate
62-
if [[ -z ${ci_clusters} ]]; then
62+
if [[ -z "${ci_clusters}" ]]; then
6363
echo "No clusters to delete."
6464
exit 0
6565
fi
66-
67-
for cluster_prefix in ${ci_clusters}
68-
do
69-
echo "Processing cluster: $cluster_prefix"
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 "Multiple servers found for control node '${cluster_prefix}-control'. Checking tags for each..."
76-
77-
for server in $(echo "$CONTROL_SERVERS" | jq -r '.[].ID'); do
78-
# Get tags for each control node
79-
TAGS=$(openstack server show "$server" --column tags --format value)
80-
81-
if [[ $TAGS =~ "keep" ]]; then
82-
echo "Skipping ${cluster_prefix} (server ${server}) - control instance is tagged as keep"
83-
else
84-
./dev/delete-cluster.py ${cluster_prefix} --force
85-
fi
86-
done
87-
else
88-
# If only one server, extract its tags and proceed
89-
TAGS=$(echo "$CONTROL_SERVERS" | jq -r '.[0].Tags')
90-
if [[ $TAGS =~ "keep" ]]; then
91-
echo "Skipping ${cluster_prefix} - control instance is tagged as keep"
92-
else
93-
./dev/delete-cluster.py ${cluster_prefix} --force
94-
fi
95-
fi
96-
done
66+
echo "Deleting clusters: ${ci_clusters}"
67+
./dev/delete-cluster.py ${ci_clusters} --force
9768
shell: bash

0 commit comments

Comments
 (0)