From 8a64dbdc0e4b2eb72e0315f5cfb64be9dda663a7 Mon Sep 17 00:00:00 2001 From: Danil Grigorev Date: Mon, 23 Sep 2024 10:45:22 +0200 Subject: [PATCH] Integrate GCP janitor to the e2e (#750) Signed-off-by: Danil-Grigorev --- .github/workflows/run-e2e-suite.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/run-e2e-suite.yaml b/.github/workflows/run-e2e-suite.yaml index 858acf8c..fb9716f6 100644 --- a/.github/workflows/run-e2e-suite.yaml +++ b/.github/workflows/run-e2e-suite.yaml @@ -23,6 +23,11 @@ on: required: false default: false type: boolean + run_gcp_janitor: + description: "Run the GCP janitor after the test to cleanup" + required: false + default: true + type: boolean permissions: contents: read @@ -104,6 +109,16 @@ jobs: client-secret: ${{ secrets.AZURE_CLIENT_SECRET}} tenant-id: ${{ secrets.AZURE_TENANT_ID}} commit: true + - name: Cleanup GCP Resources + if: ${{ inputs.run_gcp_janitor && always() }} + uses: rancher-sandbox/gcp-janitor@v0.1.0 + with: + credentials-json: ${{ secrets.GCP_CREDENTIALS }} + zones: ${{ secrets.GCP_ZONE }} + project-id: ${{ secrets.GCP_PROJECT }} + age-in-hours: 6 + resource-label-key: ${{ secrets.GCP_LABEL_KEY }} + resource-label-value: ${{ secrets.GCP_LABEL_VALUE }} - name: Send failed status to slack if: failure() uses: slackapi/slack-github-action@v1.26.0