Add deployment creation if it doesn't exist
This commit is contained in:
parent
58fd99b760
commit
01c85cbb7a
@ -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: |
|
||||
|
||||
Loading…
Reference in New Issue
Block a user