Skip to content

Commit a40b77c

Browse files
authored
flatten multiline list of clusters
1 parent 8aea048 commit a40b77c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/nightly-cleanup.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,21 @@ jobs:
4444
run: |
4545
. venv/bin/activate
4646
CI_CLUSTERS=$(openstack server list | grep --only-matching 'slurmci-RL.-[0-9]\+' | sort | uniq || true)
47+
echo "DEBUG: Raw CI clusters: $CI_CLUSTERS"
48+
4749
if [[ -z "$CI_CLUSTERS" ]]; then
4850
echo "No matching CI clusters found."
4951
else
50-
echo "Found clusters: $CI_CLUSTERS"
51-
echo "ci_clusters=$CI_CLUSTERS" >> $GITHUB_ENV
52+
# Flatten multiline value so can be passed as env var
53+
CI_CLUSTERS_FORMATTED=$(echo "$CI_CLUSTERS" | tr '\n' ' ' | sed 's/ $//')
54+
echo "DEBUG: Formatted CI clusters: $CI_CLUSTERS_FORMATTED"
55+
echo "ci_clusters=$CI_CLUSTERS_FORMATTED" >> $GITHUB_ENV
5256
fi
5357
shell: bash
5458

5559
- name: Delete clusters if control node not tagged with keep
5660
run: |
5761
. venv/bin/activate
58-
echo "Found clusters: ${{ env.ci_clusters }}"
5962
if [[ -z ${ci_clusters} ]]; then
6063
echo "No clusters to delete."
6164
exit 0
@@ -67,7 +70,7 @@ jobs:
6770
if [[ $TAGS =~ "keep" ]]; then
6871
echo "Skipping ${cluster_prefix} - control instance is tagged as keep"
6972
else
70-
yes | ./dev/delete-cluster.py ${cluster_prefix}
73+
./dev/delete-cluster.py ${cluster_prefix} --force
7174
fi
7275
done
7376
shell: bash

0 commit comments

Comments
 (0)