Add deployment creation if it doesn't exist
Some checks failed
Build and Deploy to K3s / build-and-push (push) Successful in 34s
Build and Deploy to K3s / deploy (push) Failing after 5m9s

This commit is contained in:
jasonwitty 2025-11-28 12:41:34 -08:00
parent 58fd99b760
commit 01c85cbb7a

View File

@ -89,12 +89,25 @@ jobs:
run: |
kubectl get deployment socktop-webterm -n default || echo "Deployment will be created"
- name: Update deployment image
- name: Check and create/update deployment
run: |
VERSION="${{ needs.build-and-push.outputs.version }}"
kubectl set image deployment/socktop-webterm \
webterm=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
-n default
# Check if deployment exists
if kubectl get deployment socktop-webterm -n default &> /dev/null; then
echo "Deployment exists, updating image..."
kubectl set image deployment/socktop-webterm \
webterm=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
-n default
else
echo "Deployment does not exist, creating it..."
kubectl apply -f kubernetes/03-deployment.yaml
# Update the image to the correct version
kubectl set image deployment/socktop-webterm \
webterm=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
-n default
fi
- name: Wait for rollout to complete
run: |