Skip to content

Commit 6c95302

Browse files
authored
CI: Cleanup keys with packer_* prefix (azimuth-cloud#230)
* Delete keys with a packer_* prefix * Target just one cloud
1 parent e9998b7 commit 6c95302

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,21 @@ on:
1414
type: boolean
1515
description: "Delete all CI user keypairs"
1616
required: true
17+
target-cloud:
18+
description: >-
19+
The cloud to target for the run.
20+
Leave blank to use the default cloud.
21+
type: choice
22+
options:
23+
- ""
24+
- arcus
25+
- leafcloud
26+
1727

1828
permissions: {}
1929

2030
jobs:
2131
ci-cleanup:
22-
strategy:
23-
matrix:
24-
target-cloud: [arcus, leafcloud]
2532
name: Clean up stale CI resources
2633
if: github.repository == 'azimuth-cloud/azimuth-config'
2734
runs-on: ubuntu-latest
@@ -71,16 +78,16 @@ jobs:
7178
done
7279
exit $result
7380
env:
74-
OS_CLOUD: ${{ matrix.target-cloud }}
81+
OS_CLOUD: ${{ inputs.target-cloud || vars.TARGET_CLOUD }}
7582

7683
- name: Clean up all SSH keypairs
7784
if: ${{ inputs.delete-all-keypairs }}
7885
run: |
7986
for keypair in $(openstack keypair list --format value -c Name); do
80-
if [[ "$keypair" =~ ^azimuth- ]]; then
87+
if [[ "$keypair" =~ ^azimuth- || "$keypair" =~ ^packer_ ]]; then
8188
openstack keypair delete $keypair
8289
echo "Deleted keypair $keypair"
8390
fi
8491
done
8592
env:
86-
OS_CLOUD: ${{ matrix.target-cloud }}
93+
OS_CLOUD: ${{ inputs.target-cloud || vars.TARGET_CLOUD }}

0 commit comments

Comments
 (0)