Skip to content

Commit db55719

Browse files
authored
Add manual workflow for cleanup of CI clusters (#852)
* Add manual workflow for cleanup * editing job * created workflow tasks to delete given CI cluster * adding skip comment * changed task name * add force flag * delete RL8 and RL9 clusters in same run * add task to check cluster name not empty
1 parent ee9e5a9 commit db55719

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

.github/workflows/workflow-cleanup.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- SMS
1313
- ARCUS
1414
cluster_name:
15-
description: 'Cluster to delete'
15+
description: 'Cluster to delete (workflow run number)'
1616
type: string
1717
required: true
1818

@@ -24,15 +24,47 @@ permissions:
2424
statuses: write
2525

2626
jobs:
27-
dummy:
28-
name: dummy-job1
27+
ci_cluster_cleanup:
28+
name: ci-cluster-cleanup
2929
runs-on: ubuntu-22.04
3030
env:
31+
OS_CLOUD: openstack
3132
CI_CLOUD: ${{ github.event.inputs.ci_cloud }}
3233
CLUSTER_NAME: ${{ github.event.inputs.cluster_name }}
33-
3434
steps:
35-
- name: print input vars
35+
- uses: actions/checkout@v4
36+
37+
- name: Input Variables
3638
run: |
3739
echo CI_CLOUD: ${{ env.CI_CLOUD }}
3840
echo CLUSTER_NAME: ${{ env.CLUSTER_NAME }}
41+
42+
- name: Check Cluster Name not empty
43+
run: |
44+
if [ -z ${{ env.CLUSTER_NAME }} ]; then
45+
echo "Cluster name is empty"
46+
exit 1
47+
else
48+
echo "Cluster name is not empty"
49+
fi
50+
51+
- name: Setup environment
52+
run: |
53+
python3 -m venv venv
54+
. venv/bin/activate
55+
pip install -U pip
56+
pip install "$(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)"
57+
shell: bash
58+
59+
- name: Write clouds.yaml
60+
run: |
61+
mkdir -p ~/.config/openstack
62+
echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
63+
shell: bash
64+
65+
- name: Delete CI cluster
66+
run: |
67+
. venv/bin/activate
68+
./dev/delete-cluster.py slurmci-RL8-${{ env.CLUSTER_NAME }} --force
69+
./dev/delete-cluster.py slurmci-RL9-${{ env.CLUSTER_NAME }} --force
70+
shell: bash

0 commit comments

Comments
 (0)