diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2019-06-17 08:41:29 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2019-06-17 08:42:51 +0000 |
commit | e132a279557c5a369650c5ba5908e0429ae74506 (patch) | |
tree | 179a065f2c057b7cfedb65c2079b0e24531e07fe /start-container-docker.sh | |
parent | 007fc5541e8baa9d06abf5420ba272af0c750e2f (diff) |
start-container-docker.sh: Report ssh error codes
We have noticed random errors because ssh seems to fail. Detect such
cases and print the error code, to help debug the problem.
Change-Id: I05f909410cea30157bd78e79975d6dc0349b59bb
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-x | start-container-docker.sh | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh index 2f10e5df..de8f799d 100755 --- a/start-container-docker.sh +++ b/start-container-docker.sh @@ -35,6 +35,12 @@ usage() { exit 1 } +ssh_error() +{ + echo "ERROR: ssh returned with code: $1, date: $(date)" + return $1 +} + # Save stdout/stderr file descriptors exec 3>&1 4>&2 @@ -204,7 +210,7 @@ fi image=linaro/ci-${container_arch}-tcwg-${task}-ubuntu:${distro} DOCKER="ssh $session_host docker" -$DOCKER pull $image +$DOCKER pull $image || ssh_error $? SECURITY="--cap-add=SYS_PTRACE" # We need this because of a bug in libgo's configure script: @@ -252,7 +258,7 @@ docker_run=($DOCKER run --name $session_name -dtP \ --pids-limit=${pids} \ --cpu-shares=${cpus} \ ${docker_opts} \ - $image) + $image) || ssh_error $? echo "${docker_run[@]}" # FIXME: It seems in some cases $DOCKER run generates a session_id but @@ -278,7 +284,7 @@ if [ x"$newuser" != x"" ]; then $DOCKER exec "$session_id" new-user.sh --user $newuser fi -session_port=$($DOCKER port $session_id 22 | cut -d: -f 2) +session_port=$($DOCKER port $session_id 22 | cut -d: -f 2) || ssh_error $? # Wait until the ssh server is ready to serve connexions # Make sure connexion messages go to stderr, so that in case of |