fix(deploy): guard dev pusher config rollout (#9691) #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Deploy Backend Pusher to GKE (Development) | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| - 'backend/pusher/**' | |
| - 'backend/charts/pusher/**' | |
| # Share the development pusher lock with manual deployments. | |
| concurrency: | |
| group: deploy-gke-pusher-development | |
| cancel-in-progress: false | |
| env: | |
| SERVICE: pusher | |
| REGION: us-central1 | |
| jobs: | |
| deploy: | |
| environment: development | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| runs-on: ubuntu-latest | |
| steps: | |
| # To workaround "no space left on device" issue of GitHub-hosted runner | |
| - name: Delete huge unnecessary tools folder | |
| run: rm -rf /opt/hostedtoolcache | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Google Auth | |
| id: auth | |
| uses: 'google-github-actions/auth@v2' | |
| with: | |
| credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
| - name: Set up gcloud | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Login to GCR | |
| run: gcloud auth configure-docker | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Google Service Account | |
| run: echo "${{ secrets.GCP_SERVICE_ACCOUNT }}" | base64 -d > ./backend/google-credentials.json | |
| - name: Build and Push Docker image | |
| run: | | |
| docker build -t gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:${GITHUB_SHA::7} -f backend/pusher/Dockerfile . | |
| docker push gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}:${GITHUB_SHA::7} | |
| - name: Get GKE credentials | |
| uses: google-github-actions/get-gke-credentials@v2 | |
| with: | |
| cluster_name: ${{ vars.GKE_CLUSTER }} | |
| location: ${{ env.REGION }} | |
| project_id: ${{ vars.GCP_PROJECT_ID }} | |
| - name: Preflight pusher ConfigMap and Secret references | |
| run: | | |
| python3 -m pip install -q pyyaml | |
| python3 backend/scripts/verify_pusher_config_references.py \ | |
| --environment ${{ vars.ENV }} --namespace ${{ vars.ENV }}-omi-backend | |
| - name: Deploy Pusher to GKE cluster using Helm | |
| run: | | |
| helm -n ${{ vars.ENV }}-omi-backend upgrade --install ${{ vars.ENV }}-omi-pusher ./backend/charts/pusher -f ./backend/charts/pusher/${{ vars.ENV }}_omi_pusher_values.yaml --set-string "image.tag=${GITHUB_SHA::7}" | |
| kubectl -n ${{ vars.ENV }}-omi-backend rollout status deploy/${{ vars.ENV }}-omi-pusher --timeout=300s | |
| - name: Show Output | |
| run: echo "Pusher deployed to development environment" |