From 36d05cd677b9646fcaa1b4ae68fdc40af7905849 Mon Sep 17 00:00:00 2001 From: miampf Date: Mon, 25 Mar 2024 14:50:34 +0100 Subject: [PATCH] conditionally delete artifact --- .github/workflows/e2e-test.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 7d89b6327..9f3761cb7 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -200,6 +200,7 @@ jobs: checks: write contents: read packages: write + actions: write needs: [find-latest-image, generate-input-parameters] if: always() && !cancelled() steps: @@ -279,6 +280,23 @@ jobs: azureCredentials: ${{ secrets.AZURE_E2E_IAM_CREDENTIALS }} gcpServiceAccount: "iam-e2e@constellation-e2e.iam.gserviceaccount.com" + - name: Check if tfstate should be deleted + if: always() + shell: bash + run: | + if [ ! -d constellation-terraform ] && [ ! -d constellation-iam-terraform]; then + echo "DELETE_TF_STATE=true" >> "$GITHUB_ENV" + else + echo "DELETE_TF_STATE=false" >> "$GITHUB_ENV" + fi + + - name: Delete tfstate artifact + if: env.DELETE_TF_STATE == 'true' + uses: ./.github/actions/artifact_delete + with: + name: terraform-state-${{ steps.e2e_test.outputs.namePrefix }} + workflowID: ${{ github.run_id }} + - name: Prepare terraform state folders if: always() shell: bash