Add deployment creation if it doesn't exist
This commit is contained in:
parent
58fd99b760
commit
01c85cbb7a
@ -89,12 +89,25 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
kubectl get deployment socktop-webterm -n default || echo "Deployment will be created"
|
kubectl get deployment socktop-webterm -n default || echo "Deployment will be created"
|
||||||
|
|
||||||
- name: Update deployment image
|
- name: Check and create/update deployment
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ needs.build-and-push.outputs.version }}"
|
VERSION="${{ needs.build-and-push.outputs.version }}"
|
||||||
|
|
||||||
|
# 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 \
|
kubectl set image deployment/socktop-webterm \
|
||||||
webterm=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
|
webterm=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
|
||||||
-n default
|
-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
|
- name: Wait for rollout to complete
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user