From 66a7cb9bb97cf6ddb19329d588910e04a5078c0e Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Wed, 22 Jan 2025 16:54:17 +0100 Subject: [PATCH 01/11] chore: update the preview-env teardown workflow to delete the deployment/environment during teardown Related to: camunda/team-infrastructure#456 --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 73d69c303b..9a6ef68122 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -38,6 +38,20 @@ jobs: secrets: | secret/data/products/connectors/ci/common ARGOCD_TOKEN; ######################################################################### + # Setup: generate github app token + - name: Generate a GitHub token + id: github-token + uses: camunda/infra-global-github-actions/generate-github-app-token-from-vault-secrets@main + with: + github-app-id-vault-key: GITHUB_PREVIEW_ENVIRONMENTS_APP_ID + github-app-id-vault-path: secret/data/products/connectors/ci/common + github-app-private-key-vault-key: GITHUB_PREVIEW_ENVIRONMENTS_APP_PRIVATE_KEY + github-app-private-key-vault-path: secret/data/products/connectors/ci/common + vault-auth-method: approle + vault-auth-role-id: ${{ secrets.VAULT_ROLE_ID }} + vault-auth-secret-id: ${{ secrets.VAULT_SECRET_ID}} + vault-url: ${{ secrets.VAULT_ADDR }} + ######################################################################### # Setup: checkout code. This is required because we are using # composite actions and deployment manifests. - name: Checkout @@ -45,11 +59,12 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@main + uses: camunda/infra-global-github-actions/preview-env/destroy@e7a5cf24d2edab2b478197f14b2b03eba7842cbf with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} app_name: connectors-${{ steps.sanitize.outputs.branch_name }}-${{ matrix.product_context }} + github_token: ${{ steps.github-token.outputs.token }} clean: if: always() && needs.teardown-preview.result != 'skipped' uses: camunda/connectors/.github/workflows/PREVIEW-ENV-CLEAN.yml@main From 73413e8eb24e238e929c2cc1e10d70aab3728c47 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Wed, 22 Jan 2025 17:33:21 +0100 Subject: [PATCH 02/11] chore(preview-env): update sha for testing purposes --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 9a6ef68122..3f889183ce 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@e7a5cf24d2edab2b478197f14b2b03eba7842cbf + uses: camunda/infra-global-github-actions/preview-env/destroy@c44dd4b7a6600f91bdd6653901123d4edc8853eb #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From 1136aa8b54a7172c1f57ffa746df9f32e096ce00 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Thu, 23 Jan 2025 15:01:19 +0100 Subject: [PATCH 03/11] chore: update branch version --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 3f889183ce..324436318d 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@c44dd4b7a6600f91bdd6653901123d4edc8853eb #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@cead67015c47920f9ba1554256885190b1f08635a #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From ea3154176308e1b423e587a9cff3a8aa8b8f7c61 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Thu, 23 Jan 2025 15:51:08 +0100 Subject: [PATCH 04/11] chore: fix sha for referenced action --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 324436318d..37af209c00 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@cead67015c47920f9ba1554256885190b1f08635a #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@ead67015c47920f9ba1554256885190b1f08635a #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From 1e7f50dbb123a990525f7783049c69e2d762d794 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Thu, 23 Jan 2025 16:03:25 +0100 Subject: [PATCH 05/11] chore: fix sha of preview-env-destroy composite action --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 37af209c00..aaac767c89 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@ead67015c47920f9ba1554256885190b1f08635a #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@c4e343de4774a238350755181203b116ea2b6761 #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From 471ef41249f3918c362e5ff7db372465ed35ddbf Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Thu, 23 Jan 2025 16:33:34 +0100 Subject: [PATCH 06/11] chore: fix sha for preview-env-destroy composite action --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index aaac767c89..910efbfbf8 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@c4e343de4774a238350755181203b116ea2b6761 #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@fa822a648f554e455637bc2f0842b32042fdf06b #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From 9132c86584b4b47438b68114050db6b9c2e062aa Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Thu, 23 Jan 2025 16:57:32 +0100 Subject: [PATCH 07/11] choer: fix sha for preview-env-destroy --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 910efbfbf8..c7b2a98ad6 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@fa822a648f554e455637bc2f0842b32042fdf06b #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@dbb7c2e1d7e6856f08fd736535e186b9ded5e470 #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From f6ea90dcf4d5f19d585f8054e2bfc56599529e28 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Fri, 24 Jan 2025 12:53:38 +0100 Subject: [PATCH 08/11] chore: test action without github_token --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index c7b2a98ad6..f4862f43e5 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -64,7 +64,7 @@ jobs: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} app_name: connectors-${{ steps.sanitize.outputs.branch_name }}-${{ matrix.product_context }} - github_token: ${{ steps.github-token.outputs.token }} + # github_token: ${{ steps.github-token.outputs.token }} clean: if: always() && needs.teardown-preview.result != 'skipped' uses: camunda/connectors/.github/workflows/PREVIEW-ENV-CLEAN.yml@main From f73190cb53774de4a8f258a60c73f042eb203857 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Fri, 24 Jan 2025 15:25:10 +0100 Subject: [PATCH 09/11] chore: update reference to composite action --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index f4862f43e5..1f313bd1f3 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@dbb7c2e1d7e6856f08fd736535e186b9ded5e470 #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@4d371d80474495ee187df50b76dadb8810dedbd7 #infra-456-feature-branch with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} From af08a53147d0fb9010068f489f2bda1a1266064f Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Fri, 24 Jan 2025 15:32:47 +0100 Subject: [PATCH 10/11] chore: reset the github_token input --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index 1f313bd1f3..a7f3d067bd 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -64,7 +64,7 @@ jobs: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }} app_name: connectors-${{ steps.sanitize.outputs.branch_name }}-${{ matrix.product_context }} - # github_token: ${{ steps.github-token.outputs.token }} + github_token: ${{ steps.github-token.outputs.token }} clean: if: always() && needs.teardown-preview.result != 'skipped' uses: camunda/connectors/.github/workflows/PREVIEW-ENV-CLEAN.yml@main From 48dc2ceddc427f1c0844339152966518f2769e36 Mon Sep 17 00:00:00 2001 From: Luca Cherubin Date: Fri, 24 Jan 2025 16:17:48 +0100 Subject: [PATCH 11/11] chore: restore branch version '@main' --- .github/workflows/PREVIEW-ENV-TEARDOWN.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml index a7f3d067bd..6b1812fbb1 100644 --- a/.github/workflows/PREVIEW-ENV-TEARDOWN.yml +++ b/.github/workflows/PREVIEW-ENV-TEARDOWN.yml @@ -59,7 +59,7 @@ jobs: ######################################################################### # Tear down preview environment - name: Tear down Preview Environment for ${{ matrix.product_context }} - uses: camunda/infra-global-github-actions/preview-env/destroy@4d371d80474495ee187df50b76dadb8810dedbd7 #infra-456-feature-branch + uses: camunda/infra-global-github-actions/preview-env/destroy@main with: revision: ${{ env.BRANCH_NAME }} argocd_token: ${{ steps.secrets.outputs.ARGOCD_TOKEN }}