summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2019-08-16 12:35:59 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2019-08-16 12:35:59 +0000
commit25c9fa9cdf6009af8e4a934500040d1f0d9d9a4e (patch)
treef1fe7a144bda866e439292ad3c4eb835ba14f427 /start-container-docker.sh
parent8d78d98fd80c899e2005624dccbf95d397f704ef (diff)
start-container-docker.sh: Invoke ssh with "-S none"
to avoid race conditions with several builds in parallel. This is likely causing the random ssh errors we have been facing. Change-Id: I28f3bdcedd6a41f60adb19975a65bcbde7cef7b8
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index b61d15b8..ca2c5171 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -210,7 +210,11 @@ fi
image=linaro/ci-${container_arch}-tcwg-${task}-ubuntu:${distro}
-DOCKER="ssh -v $session_host docker"
+# Avoid connexion sharing because of race conditions with parallel
+# builds
+SSH="ssh -S none"
+
+DOCKER="$SSH -v $session_host docker"
$DOCKER pull $image || ssh_error $?
SECURITY="--cap-add=SYS_PTRACE"
@@ -224,7 +228,7 @@ SECURITY="--cap-add=SYS_PTRACE"
SECURITY="${SECURITY} --security-opt seccomp:unconfined"
# Reserve resources according to weight and task
-nproc=$(ssh -v $session_host nproc --all)
+nproc=$($SSH -v $session_host nproc --all)
memory=$(print_memory_limit "$task" "$weight" "$nproc")
pids=$(print_pids_limit "$task" "$weight")
cpus=$(print_cpu_shares "$task" "$weight")
@@ -241,7 +245,7 @@ for bind_mount in "${bind_mounts[@]}"; do
# If a host bind-mount dir doesn't exist, then docker creates it on
# the host with root:root owner, which can't be removed by cleanup job.
dir="${bind_mount%%:*}"
- ssh -v $session_host mkdir -p "$dir"
+ $SSH -v $session_host mkdir -p "$dir"
docker_dir=$(print_docker_path "$dir")
bind_mounts_opt=("${bind_mounts_opt[@]}" "-v" "$docker_dir:$bind_mount")
@@ -270,8 +274,8 @@ session_id=$("${docker_run[@]}") || ret=$?
if [ $ret -ne 0 ]; then
if [ $ret -eq 255 ]; then
- echo "WARNING: ssh $session_host returned an error ($ret). Trying another ssh connexion to get debug logs"
- ssh -v $session_host true
+ echo "WARNING: $SSH $session_host returned an error ($ret). Trying another ssh connexion to get debug logs"
+ $SSH -v $session_host true
else
echo "WARNING: docker run returned an error: $ret, trying to continue nonetheless..."
fi
@@ -318,7 +322,7 @@ exec 1>&3 2>&4
cat <<EOF
# v1 interface
-CONTAINER="${dryruncmd} ssh -p ${session_port} ${user}${session_host}"
+CONTAINER="${dryruncmd} $SSH -p ${session_port} ${user}${session_host}"
CONTAINER_CLEANUP="${CONTAINER_CLEANUP}"
session_host=${session_host}
session_port=${session_port}
@@ -328,7 +332,7 @@ session_port=${session_port}
# Source jenkins-helpers.sh for remote_exec
. "$(dirname "$(readlink -f "$0")")/jenkins-helpers.sh"
-${prefix}CONTAINER_RSH="${dryruncmd} ssh -p ${session_port} ${user}${session_host}"
+${prefix}CONTAINER_RSH="${dryruncmd} $SSH -p ${session_port} ${user}${session_host}"
${prefix}container_cleanup ()
{
[ -f /sys/fs/cgroup/memory/memory.failcnt ] && echo "Number of memory usage failures:" && cat /sys/fs/cgroup/memory/memory.failcnt