From 74cc0ceb0c982f32a93243da3165afc976cb032e Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Thu, 20 Nov 2025 14:36:42 +0000 Subject: [PATCH 1/8] Add manual workflow for cleanup --- .github/workflows/workflow-cleanup.yml | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/workflow-cleanup.yml diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml new file mode 100644 index 000000000..7d618ec98 --- /dev/null +++ b/.github/workflows/workflow-cleanup.yml @@ -0,0 +1,35 @@ +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' + type: string + required: true + + +permissions: + contents: read + packages: write + # To report GitHub Actions status checks + statuses: write + +jobs: + dummy: + name: dummy-job1 + runs-on: ubuntu-22.04 + + steps: + - name: print hellow + run: | + print hello + shell: bash From bffb6119db5044a5885061d9279662aedbb9ecad Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Thu, 20 Nov 2025 14:41:05 +0000 Subject: [PATCH 2/8] editing job --- .github/workflows/workflow-cleanup.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index 7d618ec98..d3fa3b009 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -27,9 +27,12 @@ jobs: dummy: name: dummy-job1 runs-on: ubuntu-22.04 + env: + CI_CLOUD: ${{ github.event.inputs.ci_cloud }} + CLUSTER_NAME: ${{ github.event.inputs.cluster_name }} steps: - - name: print hellow + - name: print input vars run: | - print hello - shell: bash + echo CI_CLOUD: ${{ env.CI_CLOUD }} + echo CLUSTER_NAME: ${{ env.CLUSTER_NAME }} From cdcc66aaeae69a5ec0b0005e5547f4be784f90c4 Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Fri, 21 Nov 2025 13:40:13 +0000 Subject: [PATCH 3/8] created workflow tasks to delete given CI cluster --- .github/workflows/workflow-cleanup.yml | 31 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index d3fa3b009..75cd35e03 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -1,7 +1,6 @@ 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' @@ -12,7 +11,7 @@ on: - SMS - ARCUS cluster_name: - description: 'Cluster to delete' + description: 'Cluster to delete (RL*-***)' type: string required: true @@ -24,15 +23,37 @@ permissions: statuses: write jobs: - dummy: - name: dummy-job1 + ci_cleanup: + name: ci-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: print input vars 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 }} + shell: bash From 52f3e9dc1d35b80e4675d6b8c1920cdb80a14927 Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Fri, 21 Nov 2025 15:23:12 +0000 Subject: [PATCH 4/8] adding skip comment --- .github/workflows/workflow-cleanup.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index 75cd35e03..6adaf803e 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -1,6 +1,7 @@ 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' @@ -23,8 +24,8 @@ permissions: statuses: write jobs: - ci_cleanup: - name: ci-cleanup + ci__cluster_cleanup: + name: ci-cluster-cleanup runs-on: ubuntu-22.04 env: OS_CLOUD: openstack From 886bfb12d67b3338604ee7c8985e4666bc0d6fe5 Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Mon, 24 Nov 2025 09:04:20 +0000 Subject: [PATCH 5/8] changed task name --- .github/workflows/workflow-cleanup.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index 6adaf803e..0a47c7a24 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -24,7 +24,7 @@ permissions: statuses: write jobs: - ci__cluster_cleanup: + ci_cluster_cleanup: name: ci-cluster-cleanup runs-on: ubuntu-22.04 env: @@ -34,7 +34,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: print input vars + - name: Input Variables run: | echo CI_CLOUD: ${{ env.CI_CLOUD }} echo CLUSTER_NAME: ${{ env.CLUSTER_NAME }} From d21cd580df40f01859f92cf7523f0e23a6915f8a Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Mon, 24 Nov 2025 11:10:45 +0000 Subject: [PATCH 6/8] add force flag --- .github/workflows/workflow-cleanup.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index 0a47c7a24..64fb12015 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -56,5 +56,5 @@ jobs: - name: Delete CI cluster run: | . venv/bin/activate - ./dev/delete-cluster.py slurmci-${{ env.CLUSTER_NAME }} + ./dev/delete-cluster.py slurmci-${{ env.CLUSTER_NAME }} --force shell: bash From ce85cddea956a5ed6f5c555dda81ef86ebd5919a Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Mon, 24 Nov 2025 11:20:01 +0000 Subject: [PATCH 7/8] delete RL8 and RL9 clusters in same run --- .github/workflows/workflow-cleanup.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index 64fb12015..095934b21 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -12,7 +12,7 @@ on: - SMS - ARCUS cluster_name: - description: 'Cluster to delete (RL*-***)' + description: 'Cluster to delete (workflow run number)' type: string required: true @@ -56,5 +56,6 @@ jobs: - name: Delete CI cluster run: | . venv/bin/activate - ./dev/delete-cluster.py slurmci-${{ env.CLUSTER_NAME }} --force + ./dev/delete-cluster.py slurmci-RL8-${{ env.CLUSTER_NAME }} --force + ./dev/delete-cluster.py slurmci-RL9-${{ env.CLUSTER_NAME }} --force shell: bash From 0b9999252e4ebe5c97325f40b82d39577f935f4e Mon Sep 17 00:00:00 2001 From: Claudia Watson Date: Mon, 24 Nov 2025 11:31:54 +0000 Subject: [PATCH 8/8] add task to check cluster name not empty --- .github/workflows/workflow-cleanup.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/workflow-cleanup.yml b/.github/workflows/workflow-cleanup.yml index 095934b21..1b1ddaa5f 100644 --- a/.github/workflows/workflow-cleanup.yml +++ b/.github/workflows/workflow-cleanup.yml @@ -39,6 +39,15 @@ jobs: echo CI_CLOUD: ${{ env.CI_CLOUD }} echo CLUSTER_NAME: ${{ env.CLUSTER_NAME }} + - name: Check Cluster Name not empty + run: | + if [ -z ${{ env.CLUSTER_NAME }} ]; then + echo "Cluster name is empty" + exit 1 + else + echo "Cluster name is not empty" + fi + - name: Setup environment run: | python3 -m venv venv