-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1295 from stackhpc/2024.1-cleanup-multinodes
CI: Clean up periodic multinode instances on CI hosting cloud
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,26 @@ jobs: | |
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} | ||
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} | ||
|
||
- name: Clean up GH actions multinode instances over 12 hours old | ||
run: | | ||
result=0 | ||
changes_before=$(date -Imin -d -12hours) | ||
for status in ACTIVE BUILD ERROR SHUTOFF; do | ||
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 | ||
echo "Cleaning up $status instance $instance" | ||
openstack server show $instance | ||
if ! openstack server delete $instance; then | ||
echo "Failed to delete $status instance $instance" | ||
result=1 | ||
fi | ||
done | ||
done | ||
exit $result | ||
env: | ||
OS_CLOUD: openstack | ||
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} | ||
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} | ||
|
||
- name: Send message to Slack via Workflow Builder | ||
uses: slackapi/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters