Skip to content

Commit f0688f3

Browse files
committed
CI: Clean up periodic multinode instances on CI hosting cloud
Uses the same workflow that is used to clean up aio instances.
1 parent 97f8975 commit f0688f3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/stackhpc-ci-cleanup.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,23 @@ jobs:
7575
OS_CLOUD: openstack
7676
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
7777
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
78+
79+
- name: Clean up periodic multinode instances over 12 hours old
80+
run: |
81+
result=0
82+
changes_before=$(date -Imin -d -12hours)
83+
for status in ACTIVE BUILD ERROR SHUTOFF; do
84+
for instance in $(openstack server list --tags skc-multinode-periodic --os-compute-api-version 2.66 --format value --column ID --changes-before $changes_before --status $status); do
85+
echo "Cleaning up $status instance $instance"
86+
openstack server show $instance
87+
if ! openstack server delete $instance; then
88+
echo "Failed to delete $status instance $instance"
89+
result=1
90+
fi
91+
done
92+
done
93+
exit $result
94+
env:
95+
OS_CLOUD: openstack
96+
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
97+
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}

0 commit comments

Comments
 (0)