Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,27 @@ jobs:
env:
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG }}
run: |
set -euo pipefail
if [ -z "${KUBECONFIG_DATA:-}" ]; then
echo "ERROR: secrets.KUBECONFIG is missing or empty"; exit 1
fi

mkdir -p ~/.kube
echo "$KUBECONFIG_DATA" > ~/.kube/config

if DECODED="$(echo "$KUBECONFIG_DATA" | base64 -d 2>/dev/null)"; then
if echo "$DECODED" | grep -q '^apiVersion:'; then
printf '%s' "$DECODED" > ~/.kube/config
else
echo "ERROR: base64 decoded data doesn't look like kubeconfig"; exit 1
fi
else
if echo "$KUBECONFIG_DATA" | grep -q '^apiVersion:'; then
printf '%s' "$KUBECONFIG_DATA" > ~/.kube/config
else
echo "ERROR: KUBECONFIG is neither base64 nor kubeconfig YAML"; exit 1
fi
fi

chmod 600 ~/.kube/config

- name: Deploy to Kubernetes
Expand Down Expand Up @@ -157,7 +176,7 @@ jobs:
kubectl rollout restart deployment/profile-service -n default
kubectl rollout restart deployment/auth-service -n default
kubectl rollout restart deployment/feed-worker -n default

# Wait for all deployments to be ready
kubectl rollout status deployment/project-alpha -n default --timeout=300s
kubectl rollout status deployment/music-service -n default --timeout=300s
Expand Down