Idea is to get the status of the deployment after the deployment command is run, If the status says Pending, sleep for 30 seconds and check again untill the status is Completed, catch here being, timeout is 300 seconds. (if the deployment is not Completed within 300 seconds, exit with return code 1.)
service_ui_staus=$(command to check the deployment of UI service)
service_db_staus=$((command to check the deployment of DB service)
for i in $(seq 1 5); do
if [[ "${service_ui_staus}" =~ "Completed" && "${service_db_staus}" =~ "Completed" ]]; then echo "Deployments done..."
break
else
sleep 30
done
Above logic is not elegant and I've to add few more validations in the else part to fail the build, if the deployment is not completed within 300 seconds.
Any help in handling this scenario in more generic and elegantly, thanks.