From 5d0cb7959eae7aaaeedc5d9f708cca05e8e863d3 Mon Sep 17 00:00:00 2001 From: Ryan Emerson Date: Tue, 21 May 2024 10:17:15 +0100 Subject: [PATCH] Execute Aurora DB cleanup in a separate workflow to prevent timeout on cancel (#29689) Closes keycloak/keycloak-benchmark#803 Signed-off-by: Ryan Emerson --- .../actions/aurora-delete-database/action.yml | 21 ------------ .github/workflows/aurora-delete.yml | 34 +++++++++++++++++++ .github/workflows/ci.yml | 26 +++++--------- 3 files changed, 42 insertions(+), 39 deletions(-) delete mode 100644 .github/actions/aurora-delete-database/action.yml create mode 100644 .github/workflows/aurora-delete.yml diff --git a/.github/actions/aurora-delete-database/action.yml b/.github/actions/aurora-delete-database/action.yml deleted file mode 100644 index 7f53df69f8f..00000000000 --- a/.github/actions/aurora-delete-database/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Delete Aurora Database -description: Delete AWS Aurora Database - -inputs: - name: - description: 'The name of the Aurora DB cluster to delete' - required: true - region: - description: 'The AWS region hosting the Aurora DB' - required: true - -runs: - using: "composite" - steps: - - id: delete - shell: bash - run: ./aurora_delete.sh - working-directory: .github/scripts/aws/rds - env: - AURORA_CLUSTER: ${{ inputs.name }} - AURORA_REGION: ${{ inputs.region }} diff --git a/.github/workflows/aurora-delete.yml b/.github/workflows/aurora-delete.yml new file mode 100644 index 00000000000..a2759dda6bc --- /dev/null +++ b/.github/workflows/aurora-delete.yml @@ -0,0 +1,34 @@ +name: Aurora Delete + +on: + workflow_dispatch: + inputs: + name: + description: 'The name of the Aurora DB cluster' + type: string + required: true + region: + description: 'The AWS region used to host the Aurora DB' + type: string + required: true + +jobs: + delete: + name: Delete Aurora DB + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Initialize AWS client + run: | + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws configure set region ${{ inputs.region }} + + - id: delete + shell: bash + run: ./aurora_delete.sh + working-directory: .github/scripts/aws/rds + env: + AURORA_CLUSTER: ${{ inputs.name }} + AURORA_REGION: ${{ inputs.region }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6101d497ff..a547a2ca440 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -357,20 +357,6 @@ jobs: name: store-it-mvn-logs path: .github/scripts/ansible/files - - name: Delete Aurora EC2 Instance - if: ${{ always() && matrix.db == 'aurora-postgres' }} - working-directory: .github/scripts/ansible - run: | - export CLUSTER_NAME=${{ steps.aurora-tests.outputs.ec2_cluster }} - ./aws_ec2.sh delete ${{ steps.aurora-init.outputs.region }} - - - name: Delete Aurora DB - if: ${{ always() && matrix.db == 'aurora-postgres' }} - uses: ./.github/actions/aurora-delete-database - with: - name: ${{ steps.aurora-init.outputs.name }} - region: ${{ steps.aurora-init.outputs.region }} - store-integration-tests: name: Store IT needs: [build, conditional] @@ -488,10 +474,14 @@ jobs: - name: Delete Aurora DB if: ${{ always() && matrix.db == 'aurora-postgres' }} - uses: ./.github/actions/aurora-delete-database - with: - name: ${{ steps.aurora-init.outputs.name }} - region: ${{ steps.aurora-init.outputs.region }} + run: | + gh workflow run aurora-delete.yml \ + -f name=${{ steps.aurora-init.outputs.name }} \ + -f region=${{ steps.aurora-init.outputs.region }} \ + --repo ${{ github.repository }} \ + --ref ${{ github.ref_name }} + env: + GH_TOKEN: ${{ github.token }} store-model-tests: name: Store Model Tests