From 5b2cc5a79ba7c37dbc3304d8dee7bc2859e3f6de Mon Sep 17 00:00:00 2001 From: Louis GERARD Date: Fri, 16 Aug 2024 16:21:48 +0200 Subject: [PATCH] (PC-31321)[API] ci: use teleport and argocd actions --- .../workflows/dev_on_dispatch_deploy_ops.yml | 1 - .../dev_on_dispatch_release_deploy.yml | 3 -- .../workflows/dev_on_push_workflow_main.yml | 2 - .github/workflows/dev_on_workflow_deploy.yml | 54 ++++++------------- 4 files changed, 15 insertions(+), 45 deletions(-) diff --git a/.github/workflows/dev_on_dispatch_deploy_ops.yml b/.github/workflows/dev_on_dispatch_deploy_ops.yml index eb9165556fe..9eeee6682ae 100644 --- a/.github/workflows/dev_on_dispatch_deploy_ops.yml +++ b/.github/workflows/dev_on_dispatch_deploy_ops.yml @@ -14,7 +14,6 @@ jobs: with: environment: ops app_version: ${{ inputs.pcapi_image_tag }} - teleport_version: 15.2.5 teleport_proxy: teleport.ops.passculture.team:443 teleport_kubernetes_cluster: passculture-metier-ops deploy_api: true diff --git a/.github/workflows/dev_on_dispatch_release_deploy.yml b/.github/workflows/dev_on_dispatch_release_deploy.yml index fac4e866ae8..1d35d555476 100644 --- a/.github/workflows/dev_on_dispatch_release_deploy.yml +++ b/.github/workflows/dev_on_dispatch_release_deploy.yml @@ -91,7 +91,6 @@ jobs: with: environment: ${{ github.event.inputs.target_environment }} app_version: ${{ needs.version.outputs.APP_VERSION }} - teleport_version: 15.2.5 teleport_proxy: teleport.ehp.passculture.team:443 teleport_kubernetes_cluster: passculture-metier-ehp deploy_api: true @@ -109,7 +108,6 @@ jobs: with: environment: integration app_version: ${{ needs.version.outputs.APP_VERSION }} - teleport_version: 15.2.5 teleport_proxy: teleport.ehp.passculture.team:443 teleport_kubernetes_cluster: passculture-metier-ehp deploy_api: true @@ -127,7 +125,6 @@ jobs: with: environment: ${{ github.event.inputs.target_environment }} app_version: ${{ needs.version.outputs.APP_VERSION }} - teleport_version: 15.2.5 teleport_proxy: teleport.passculture.team:443 teleport_kubernetes_cluster: passculture-metier-prod deploy_api: true diff --git a/.github/workflows/dev_on_push_workflow_main.yml b/.github/workflows/dev_on_push_workflow_main.yml index 95ab9d58b4d..a2a06fd97e7 100644 --- a/.github/workflows/dev_on_push_workflow_main.yml +++ b/.github/workflows/dev_on_push_workflow_main.yml @@ -267,7 +267,6 @@ jobs: with: environment: testing app_version: ${{ github.sha }} - teleport_version: 15.2.5 teleport_proxy: teleport.ehp.passculture.team:443 teleport_kubernetes_cluster: passculture-metier-ehp deploy_api: ${{ needs.test-api.result == 'success' }} @@ -289,7 +288,6 @@ jobs: with: environment: ops app_version: ${{ github.sha }} - teleport_version: 15.2.5 teleport_proxy: teleport.ops.passculture.team:443 teleport_kubernetes_cluster: passculture-metier-ops deploy_api: ${{ needs.test-api.result == 'success' }} diff --git a/.github/workflows/dev_on_workflow_deploy.yml b/.github/workflows/dev_on_workflow_deploy.yml index 5a45e38b684..c6c7084298f 100644 --- a/.github/workflows/dev_on_workflow_deploy.yml +++ b/.github/workflows/dev_on_workflow_deploy.yml @@ -8,9 +8,6 @@ on: app_version: type: string required: true - teleport_version: - type: string - required: true teleport_proxy: type: string required: true @@ -63,21 +60,15 @@ jobs: with: secrets: |- API_TOKEN_GITHUB:passculture-metier-ehp/passculture-main-sa-access-token - - name: "Install Teleport" - uses: teleport-actions/setup@v1 - with: - version: ${{ inputs.teleport_version }} - - name: "Teleport Authentication" - uses: teleport-actions/auth-k8s@v1 - id: "teleport-auth" + + - name: "Connect to cluster" + uses: pass-culture/common-workflows/actions/teleport-connect@teleport-connect/v0.1.0 with: - proxy: ${{ inputs.teleport_proxy }} - token: github-token - certificate-ttl: 1h - kubernetes-cluster: ${{ inputs.teleport_kubernetes_cluster }} + teleport_proxy: ${{ inputs.teleport_proxy }} + teleport_kubernetes_cluster: ${{ inputs.teleport_kubernetes_cluster }} - name: "Play pre-migrations" - uses: pass-culture/common-workflows/actions/pcapi-migration@PC-31321-pcapi-migration-action + uses: pass-culture/common-workflows/actions/pcapi-migration@pcapi-migration/v0.1.0 with: environment: ${{ inputs.environment }} app_version: ${{ inputs.app_version }} @@ -126,20 +117,12 @@ jobs: api_token_github_secret_name: passculture-metier-ehp/passculture-main-sa-access-token chart_values_repository: "" helmfile_path: "./pass-culture-deployment/helm/pcapi" - - name: "Install argocd cli" - id: install_argocd_cli - run: | - curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 - sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd - rm argocd-linux-amd64 - - name: "Check argocd application status" - id: check_status - run: | - kubectl config set-context --current --namespace=argocd - argocd app sync pcapi-${{ inputs.environment }} --core --async --prune - argocd app wait pcapi-${{ inputs.environment }} --core --timeout 600 + - name: "Sync ArgoCD application" + uses: pass-culture/common-workflows/actions/argocd-sync@argocd-sync/v0.2.0 + with: + app_name: pcapi-${{ inputs.environment }} - name: "Play post-migrations" - uses: pass-culture/common-workflows/actions/pcapi-migration@PC-31321-pcapi-migration-action + uses: pass-culture/common-workflows/actions/pcapi-migration@v0.1.0 with: environment: ${{ inputs.environment }} app_version: ${{ inputs.app_version }} @@ -244,18 +227,11 @@ jobs: contents: read runs-on: ubuntu-latest steps: - - name: "Install Teleport" - uses: teleport-actions/setup@v1 - with: - version: ${{ inputs.teleport_version }} - - name: "Teleport Authentication" - id: "teleport-auth" - uses: teleport-actions/auth-k8s@v1 + - name: "Connect to cluster" + uses: pass-culture/common-workflows/actions/teleport-connect@v0.1.0 with: - proxy: ${{ inputs.teleport_proxy }} - token: github-token - certificate-ttl: 1h - kubernetes-cluster: ${{ inputs.teleport_kubernetes_cluster }} + teleport_proxy: ${{ inputs.teleport_proxy }} + teleport_kubernetes_cluster: ${{ inputs.teleport_kubernetes_cluster }} - name: "Configure algolia" id: "set_algolia_settings" uses: nick-fields/retry@v3