Skip to content

Commit

Permalink
Update deploy-dev.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hikasap authored Oct 20, 2024
1 parent 84dfa75 commit bef8e60
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ jobs:
kubectl set image deployment/frontend frontend=24cmpe451group2/frontend:${{ github.sha }} --namespace=default
kubectl set image deployment/backend backend=24cmpe451group2/backend:${{ github.sha }} --namespace=default
kubectl rollout status deployment/frontend --timeout=5m --namespace=default
kubectl rollout status deployment/backend --timeout=5m --namespace=default
# Wait for a few moments to allow Kubernetes to stabilize
echo "Waiting for the pods to stabilize..."
sleep 120
# Check frontend pods for any waiting reasons
kubectl rollout status deployment/backend --timeout=5m --namespace=default
EOF
# Sleep before checking pod status
- name: Sleep before checking pod status
run: sleep 30

# Check the status of the frontend pods
- name: Check frontend pod status
run: |
sshpass -p "${{ secrets.DO_SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no root@${{ secrets.DO_REMOTE }} << EOF
echo "Checking the status of the frontend pods:"
FRONTEND_WAITING_REASONS=\$(kubectl get pods -l app=frontend --namespace=default -o jsonpath='{.items[*].status.containerStatuses[*].state.waiting.reason}')
if [ -z "\$FRONTEND_WAITING_REASONS" ]; then
Expand All @@ -70,7 +76,12 @@ jobs:
echo "Waiting reasons for frontend pods: \$FRONTEND_WAITING_REASONS"
exit 1
fi
# Check backend pods for any waiting reasons
EOF
# Check the status of the backend pods
- name: Check backend pod status
run: |
sshpass -p "${{ secrets.DO_SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no root@${{ secrets.DO_REMOTE }} << EOF
echo "Checking the status of the backend pods:"
BACKEND_WAITING_REASONS=\$(kubectl get pods -l app=backend --namespace=default -o jsonpath='{.items[*].status.containerStatuses[*].state.waiting.reason}')
if [ -z "\$BACKEND_WAITING_REASONS" ]; then
Expand All @@ -80,5 +91,4 @@ jobs:
echo "Waiting reasons for backend pods: \$BACKEND_WAITING_REASONS"
exit 1
fi
echo "Deployment successful: Both frontend and backend pods are running."
EOF

0 comments on commit bef8e60

Please sign in to comment.