summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-05-26 10:51:15 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-05-31 17:58:51 +0000
commitdde8e7fff9804a8a52c3dbee68081c3d3ab5a798 (patch)
tree7dc0d104ec11b51415e7527bdd15699f071b26cc
parent704e206f753e72ae7325f1b535b0fd9d2a34da69 (diff)
jenkins-helpers.sh: Make print_node_with_least_container more robust
... when starting multiple containers at the same time. Change-Id: I806f5b5a414ce116e6f7cacd9bdaff3ad15821a6
-rw-r--r--jenkins-helpers.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 671ebed2..43ea64dc 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -18,15 +18,17 @@ print_node_with_least_containers ()
set -euf -o pipefail
local label
+ # Re. --random-sort below: shuffle node list to mitigate races
+ # when starting multiple containers at the same time
for label in $tester_labels; do
wget -O - https://ci.linaro.org/label/$label/api/json?pretty=true 2>/dev/null | grep nodeName | cut -d: -f 2 | sed -e 's/"//g'
- done)
+ done | sort --random-sort)
for tester in $testers; do
load_value=$(docker -H ${tester}.tcwglab:2375 ps | wc -l || echo 999)
if [ $load_value -lt $tester_min_load_value ]; then
tester_min_load_name=$tester
tester_min_load_value=$load_value
- fi
+ fi
done
echo $tester_min_load_name
)