Skip to content

Commit 922b278

Browse files
authored
Merge pull request #1295 from stackhpc/2024.1-cleanup-multinodes
CI: Clean up periodic multinode instances on CI hosting cloud
2 parents 1420778 + ebc9872 commit 922b278

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,26 @@ jobs:
7676
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
7777
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
7878

79+
- name: Clean up GH actions 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 gh-actions-multinode --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 }}
98+
7999
- name: Send message to Slack via Workflow Builder
80100
uses: slackapi/[email protected]
81101
with:

.github/workflows/stackhpc-multinode.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ name: Multinode
4343
- never
4444
- success
4545
break_duration:
46-
description: How long to break execution for (minutes)
46+
description: How long to break execution for (minutes) (note that instances are cleaned up after 12h)
4747
type: number
4848
default: 60
4949
ssh_key:

0 commit comments

Comments
 (0)