File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Cleanup CI clusters
2+ on :
3+ workflow_dispatch :
4+ inputs :
5+ ci_cloud :
6+ description : ' Select the CI_CLOUD'
7+ required : true
8+ type : choice
9+ options :
10+ - LEAFCLOUD
11+ - SMS
12+ - ARCUS
13+ schedule :
14+ - cron : ' 0 20 * * *' # Run at 8PM - image sync runs at midnight
15+
16+ jobs :
17+ ci_cleanup :
18+ name : ci-cleanup
19+ concurrency : ${{ github.workflow }}-${{ github.ref }}-${{ matrix.cloud }}
20+ strategy :
21+ fail-fast : false
22+ matrix :
23+ cloud :
24+ - LEAFCLOUD
25+ - SMS
26+ - ARCUS
27+ runs-on : ubuntu-22.04
28+ env :
29+ OS_CLOUD : openstack
30+ CI_CLOUD : ${{ matrix.cloud }}
31+ steps :
32+ - uses : actions/checkout@v2
33+
34+ - name : Record which cloud CI is running on
35+ run : |
36+ echo CI_CLOUD: ${{ env.CI_CLOUD }}
37+
38+ - name : Setup environment
39+ run : |
40+ python3 -m venv venv
41+ . venv/bin/activate
42+ pip install -U pip
43+ pip install $(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)
44+ shell : bash
45+
46+ - name : Write clouds.yaml
47+ run : |
48+ mkdir -p ~/.config/openstack/
49+ echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml
50+ shell : bash
51+
52+ - name : Find CI clusters
53+ run : |
54+ . venv/bin/activate
55+ CI_CLUSTERS=$(openstack server list | grep --only-matching 'slurmci-RL.-[0-9]\+' | sort | uniq)
56+ echo "ci_clusters=${CI_CLUSTERS}" >> GITHUB_ENV
57+ shell : bash
58+
59+ - name : Delete clusters if control node not tagged with keep
60+ run : |
61+ . venv/bin/activate
62+ for cluster_prefix in ${CI_CLUSTERS}
63+ do
64+ TAGS=$(openstack server show ${cluster_prefix}-control --column tags --format value)
65+ if [[ $TAGS =~ "keep" ]]; then
66+ echo "Skipping ${cluster_prefix} - control instance is tagged as keep"
67+ else
68+ yes | ./dev/delete-cluster.py ${cluster_prefix}
69+ fi
70+ done
71+ shell : bash
Original file line number Diff line number Diff line change 1212 - ' !docs/**'
1313 - ' !README.md'
1414 - ' !.gitignore'
15+ - ' !.github/workflows/'
16+ - ' .github/workflows/stackhpc'
1517 pull_request :
1618 paths :
1719 - ' **'
2022 - ' !docs/**'
2123 - ' !README.md'
2224 - ' !.gitignore'
25+ - ' !.github/workflows/'
26+ - ' .github/workflows/stackhpc'
2327jobs :
2428 openstack :
2529 name : openstack-ci
You can’t perform that action at this time.
0 commit comments