diff options
Diffstat (limited to 'tcwg-update-bmk-containers.sh')
-rwxr-xr-x | tcwg-update-bmk-containers.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tcwg-update-bmk-containers.sh b/tcwg-update-bmk-containers.sh new file mode 100755 index 00000000..80430db4 --- /dev/null +++ b/tcwg-update-bmk-containers.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -euf -o pipefail + +scripts=$(dirname $0) +# shellcheck source=jenkins-helpers.sh +. $scripts/jenkins-helpers.sh +convert_args_to_variables "$@" + +obligatory_variables board +declare -g board + +distro="${distro-default}" +force="${force-false}" +test_docker="${test_docker-false}" +node="${node-}" +verbose="${verbose-true}" + +if $verbose; then set -x; fi + +# Check that the board is well reachable. Reboot otherwise. +ssh_root="ssh -p22 -lroot" +wait_opts=(-p22 -lroot) +if ! timeout 1m $ssh_root "$board" true; then + echo "Trying to power-cycle $board" + ( + pdu_name=$(echo "${board%.tcwglab}" \ + | sed -e 's/^tcwg-bmk-/tcwg-/') + nvidia-power-cycle.sh "$pdu_name" + wait_for_ssh_server "$board" 150 "${wait_opts[@]}" + ) & + wait $! || exit $EXTERNAL_FAIL + echo "Successfully powered-cycled $board" +fi + +rsync -az --del -e "$ssh_root" \ + $scripts/ $board:jenkins-scripts/ +$ssh_root -Snone $board \ + ./jenkins-scripts/tcwg-update-host-containers.sh \ + --distro "$distro" \ + --group "tcwg-bmk" \ + --force "$force" \ + --test_docker "$test_docker" \ + --additional_options "--privileged" \ + --verbose "$verbose" + +wait_for_ssh_server "$board" 100 + +if [ x"$node" != x"" ]; then + rsync -az --del \ + $scripts/ $board:jenkins-scripts/ + ssh -Snone $board \ + ./jenkins-scripts/tcwg-update-host-containers.sh \ + --distro "$distro" \ + --node "$node" \ + --force "$force" \ + --verbose "$verbose" +fi |