Workflow Cleanup #5
Workflow file for this run
This file contains hidden or 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
| name: Workflow Cleanup | |
| on: | |
| workflow_dispatch: | |
| # checkov:skip=CKV_GHA_7: "The build output cannot be affected by user parameters other than the build entry point and the top-level source location. GitHub Actions workflow_dispatch inputs MUST be empty. " | |
| inputs: | |
| ci_cloud: | |
| description: 'Select the CI_CLOUD' | |
| required: true | |
| type: choice | |
| options: | |
| - LEAFCLOUD | |
| - SMS | |
| - ARCUS | |
| cluster_name: | |
| description: 'Cluster to delete (RL*-***)' | |
| type: string | |
| required: true | |
| permissions: | |
| contents: read | |
| packages: write | |
| # To report GitHub Actions status checks | |
| statuses: write | |
| jobs: | |
| ci_cluster_cleanup: | |
| name: ci-cluster-cleanup | |
| runs-on: ubuntu-22.04 | |
| env: | |
| OS_CLOUD: openstack | |
| CI_CLOUD: ${{ github.event.inputs.ci_cloud }} | |
| CLUSTER_NAME: ${{ github.event.inputs.cluster_name }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Input Variables | |
| run: | | |
| echo CI_CLOUD: ${{ env.CI_CLOUD }} | |
| echo CLUSTER_NAME: ${{ env.CLUSTER_NAME }} | |
| - name: Setup environment | |
| run: | | |
| python3 -m venv venv | |
| . venv/bin/activate | |
| pip install -U pip | |
| pip install "$(grep -o 'python-openstackclient[><=0-9\.]*' requirements.txt)" | |
| shell: bash | |
| - name: Write clouds.yaml | |
| run: | | |
| mkdir -p ~/.config/openstack | |
| echo "${{ secrets[format('{0}_CLOUDS_YAML', env.CI_CLOUD)] }}" > ~/.config/openstack/clouds.yaml | |
| shell: bash | |
| - name: Delete CI cluster | |
| run: | | |
| . venv/bin/activate | |
| ./dev/delete-cluster.py slurmci-${{ env.CLUSTER_NAME }} --force | |
| shell: bash |