Loading script/_check-deploy.sh +22 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,28 @@ do stackServices=\$(docker service ls -f name=${serviceToCheck} --format '{{.Replicas}}') ; \ serviceCount=\$(echo \"\${stackServices}\" | \${grepBin} -cE '.+') ; \ runningServiceCount=\$(echo \"\${stackServices}\" | \${grepBin} -cE '([0-9]+)\/\1') ; \ for j in \$(seq 1 ${runningServiceCount}) ; \ do \ runningServiceName=\$(docker service ls -f name=${serviceToCheck} --format '{{.Name}}') | \ head -\${j} | tail -1 ; \ runningServiceDesiredReplicas=\$(docker service ls -f name=\${runningServiceName} \ --format '{{.Replicas}}' | cut -d '/' -f 2) ; \ completedTaskCount=0 ; \ for k in \$(seq 1 ${runningServiceDesiredReplicas}) ; \ do \ runningServiceStoppedTaskState=\$(docker service ps --format '{{.CurrentState}}' \ -f 'desired-state=shutdown' -f \"name=\${runningServiceName}.\${k}\" \ \${runningServiceName} | head -1 ; \ if echo \"\${runningServiceStoppedTaskState}\" | grep 'Complete' ; \ then \ completedTaskCount=\$((\${completedTaskCount} + 1)) ; \ fi ; \ done ; \ if [ \${completedTaskCount} -eq \${runningServiceDesiredReplicas} ] ; \ then \ runningServiceCount=\$((\${runningServiceCount} + 1)) ; \ fi ; \ done ; \ statusCheckCmd=\"[ \"\${serviceCount}\" -ne \"0\" -a \ \"\${serviceCount:-_}\" = \"\${runningServiceCount:--}\" ]\" ; \ else \ Loading Loading
script/_check-deploy.sh +22 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,28 @@ do stackServices=\$(docker service ls -f name=${serviceToCheck} --format '{{.Replicas}}') ; \ serviceCount=\$(echo \"\${stackServices}\" | \${grepBin} -cE '.+') ; \ runningServiceCount=\$(echo \"\${stackServices}\" | \${grepBin} -cE '([0-9]+)\/\1') ; \ for j in \$(seq 1 ${runningServiceCount}) ; \ do \ runningServiceName=\$(docker service ls -f name=${serviceToCheck} --format '{{.Name}}') | \ head -\${j} | tail -1 ; \ runningServiceDesiredReplicas=\$(docker service ls -f name=\${runningServiceName} \ --format '{{.Replicas}}' | cut -d '/' -f 2) ; \ completedTaskCount=0 ; \ for k in \$(seq 1 ${runningServiceDesiredReplicas}) ; \ do \ runningServiceStoppedTaskState=\$(docker service ps --format '{{.CurrentState}}' \ -f 'desired-state=shutdown' -f \"name=\${runningServiceName}.\${k}\" \ \${runningServiceName} | head -1 ; \ if echo \"\${runningServiceStoppedTaskState}\" | grep 'Complete' ; \ then \ completedTaskCount=\$((\${completedTaskCount} + 1)) ; \ fi ; \ done ; \ if [ \${completedTaskCount} -eq \${runningServiceDesiredReplicas} ] ; \ then \ runningServiceCount=\$((\${runningServiceCount} + 1)) ; \ fi ; \ done ; \ statusCheckCmd=\"[ \"\${serviceCount}\" -ne \"0\" -a \ \"\${serviceCount:-_}\" = \"\${runningServiceCount:--}\" ]\" ; \ else \ Loading