Loading script/_check-deploy.sh +9 −5 Original line number Diff line number Diff line Loading @@ -13,19 +13,21 @@ do hits=0 && \ for i in \$(seq 1 ${STATUS_CHECK_RETRIES}) ; \ do \ echo \"Checking service status, try \${i}/${STATUS_CHECK_RETRIES} ...\" && \ echo \"Checking service ${serviceToCheck} status, try \${i}/${STATUS_CHECK_RETRIES} ...\" && \ if [ \"\${SWARM_MODE}\" = true ]; \ then \ stackServices=\$(docker service ls -f name=${serviceToCheck} --format '{{.Replicas}}') ; \ serviceCount=\$(echo \"\${stackServices}\" | /usr/bin/grep -cE '.+') ; \ runningServiceCount=\$(echo \"\${stackServices}\" | /usr/bin/grep -cE '([0-9]+)\/\1') ; \ statusCheckCmd=\"[ \"\${serviceCount}\" -ne \"0\" -a \"\${serviceCount:-_}\" = \"\${runningServiceCount:--}\" ]\" ; \ statusCheckCmd=\"[ \"\${serviceCount}\" -ne \"0\" -a \ \"\${serviceCount:-_}\" = \"\${runningServiceCount:--}\" ]\" ; \ else \ runningContainersIds=\$(docker ps -f status=running --format '{{.ID}}' --no-trunc) ; \ successfullyExitedContainersIds=\$(docker ps -a -f exited=0 --format '{{.ID}}' --no-trunc) ; \ serviceContainerId=\$(docker inspect --format='{{.ID}}' ${serviceToCheck} 2> /dev/null) ; \ runningService=\$(echo \"\${runningContainersIds}\" | grep \"\${serviceContainerId:--}\") ; \ successfullyExitedService=\$(echo \"\${successfullyExitedContainersIds}\" | grep \"\${serviceContainerId:--}\") ; \ successfullyExitedService=\$(echo \"\${successfullyExitedContainersIds}\" | \ grep \"\${serviceContainerId:--}\") ; \ statusCheckCmd=\"[ \${serviceContainerId:-_} = \${runningService:--} -o \ \${serviceContainerId:-_} = \${successfullyExitedService:--} ]\" ; \ fi ; \ Loading @@ -36,7 +38,8 @@ do hits=\$((\${hits} + 1)) && \ if [ \"\${hits}\" -eq \"${STATUS_CHECK_MIN_HITS}\" ] ; \ then \ echo -e \"Service is running, got ${PASS_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ echo -e \"${PASS_COLOR}Service ${serviceToCheck} is running!${NULL_COLOR}\" && \ echo -e \" got ${PASS_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ exit 0 ; \ fi ; \ else \ Loading @@ -44,7 +47,8 @@ do fi ; \ sleep ${STATUS_CHECK_INTERVAL} ; \ done ; \ echo -e \"Service is not running, got ${FAIL_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ echo -e \"${FAIL_COLOR}Service ${serviceToCheck} is not running!${NULL_COLOR}\" && \ echo -e \" got ${FAIL_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ exit 1 \ " ssh ${SSH_PARAMS} "${SSH_REMOTE}" "${checkDeployCmd}" Loading Loading
script/_check-deploy.sh +9 −5 Original line number Diff line number Diff line Loading @@ -13,19 +13,21 @@ do hits=0 && \ for i in \$(seq 1 ${STATUS_CHECK_RETRIES}) ; \ do \ echo \"Checking service status, try \${i}/${STATUS_CHECK_RETRIES} ...\" && \ echo \"Checking service ${serviceToCheck} status, try \${i}/${STATUS_CHECK_RETRIES} ...\" && \ if [ \"\${SWARM_MODE}\" = true ]; \ then \ stackServices=\$(docker service ls -f name=${serviceToCheck} --format '{{.Replicas}}') ; \ serviceCount=\$(echo \"\${stackServices}\" | /usr/bin/grep -cE '.+') ; \ runningServiceCount=\$(echo \"\${stackServices}\" | /usr/bin/grep -cE '([0-9]+)\/\1') ; \ statusCheckCmd=\"[ \"\${serviceCount}\" -ne \"0\" -a \"\${serviceCount:-_}\" = \"\${runningServiceCount:--}\" ]\" ; \ statusCheckCmd=\"[ \"\${serviceCount}\" -ne \"0\" -a \ \"\${serviceCount:-_}\" = \"\${runningServiceCount:--}\" ]\" ; \ else \ runningContainersIds=\$(docker ps -f status=running --format '{{.ID}}' --no-trunc) ; \ successfullyExitedContainersIds=\$(docker ps -a -f exited=0 --format '{{.ID}}' --no-trunc) ; \ serviceContainerId=\$(docker inspect --format='{{.ID}}' ${serviceToCheck} 2> /dev/null) ; \ runningService=\$(echo \"\${runningContainersIds}\" | grep \"\${serviceContainerId:--}\") ; \ successfullyExitedService=\$(echo \"\${successfullyExitedContainersIds}\" | grep \"\${serviceContainerId:--}\") ; \ successfullyExitedService=\$(echo \"\${successfullyExitedContainersIds}\" | \ grep \"\${serviceContainerId:--}\") ; \ statusCheckCmd=\"[ \${serviceContainerId:-_} = \${runningService:--} -o \ \${serviceContainerId:-_} = \${successfullyExitedService:--} ]\" ; \ fi ; \ Loading @@ -36,7 +38,8 @@ do hits=\$((\${hits} + 1)) && \ if [ \"\${hits}\" -eq \"${STATUS_CHECK_MIN_HITS}\" ] ; \ then \ echo -e \"Service is running, got ${PASS_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ echo -e \"${PASS_COLOR}Service ${serviceToCheck} is running!${NULL_COLOR}\" && \ echo -e \" got ${PASS_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ exit 0 ; \ fi ; \ else \ Loading @@ -44,7 +47,8 @@ do fi ; \ sleep ${STATUS_CHECK_INTERVAL} ; \ done ; \ echo -e \"Service is not running, got ${FAIL_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ echo -e \"${FAIL_COLOR}Service ${serviceToCheck} is not running!${NULL_COLOR}\" && \ echo -e \" got ${FAIL_COLOR}\${hits}/${STATUS_CHECK_MIN_HITS}${NULL_COLOR} status hits\" && \ exit 1 \ " ssh ${SSH_PARAMS} "${SSH_REMOTE}" "${checkDeployCmd}" Loading