From 7df2929fa8f5608af336af8121e9f650aa9a01e5 Mon Sep 17 00:00:00 2001 From: defiQUG Date: Tue, 28 Jul 2026 11:49:43 -0700 Subject: [PATCH] Fix CD kubeconfig handling --- .github/workflows/cd.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index db46d2f..78bcab0 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -10,6 +10,8 @@ jobs: name: Deploy to Staging runs-on: ubuntu-latest environment: staging + env: + KUBECONFIG: ${{ github.workspace }}/kubeconfig steps: - uses: actions/checkout@v4 @@ -21,19 +23,16 @@ jobs: - name: Configure kubectl run: | - echo "${{ secrets.KUBECONFIG_STAGING }}" | base64 -d > kubeconfig - export KUBECONFIG=./kubeconfig - + echo "${{ secrets.KUBECONFIG_STAGING }}" | base64 -d > "$KUBECONFIG" + - name: Deploy to Kubernetes run: | - export KUBECONFIG=./kubeconfig kubectl apply -f gitops/apps/api/ kubectl apply -f gitops/apps/frontend/ kubectl apply -f gitops/apps/portal/ - + - name: Wait for deployment run: | - export KUBECONFIG=./kubeconfig kubectl rollout status deployment/api -n sankofa kubectl rollout status deployment/frontend -n sankofa kubectl rollout status deployment/portal -n sankofa @@ -44,6 +43,8 @@ jobs: environment: production needs: [deploy-staging] if: github.ref == 'refs/heads/main' + env: + KUBECONFIG: ${{ github.workspace }}/kubeconfig steps: - uses: actions/checkout@v4 @@ -52,19 +53,16 @@ jobs: - name: Configure kubectl run: | - echo "${{ secrets.KUBECONFIG_PRODUCTION }}" | base64 -d > kubeconfig - export KUBECONFIG=./kubeconfig - + echo "${{ secrets.KUBECONFIG_PRODUCTION }}" | base64 -d > "$KUBECONFIG" + - name: Deploy to Kubernetes run: | - export KUBECONFIG=./kubeconfig kubectl apply -f gitops/apps/api/ kubectl apply -f gitops/apps/frontend/ kubectl apply -f gitops/apps/portal/ - + - name: Wait for deployment run: | - export KUBECONFIG=./kubeconfig kubectl rollout status deployment/api -n sankofa kubectl rollout status deployment/frontend -n sankofa kubectl rollout status deployment/portal -n sankofa @@ -73,4 +71,3 @@ jobs: run: | # Smoke tests would go here echo "Running smoke tests..." -