diff options
author | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2022-12-22 08:09:21 +0100 |
---|---|---|
committer | Johannes Schauer Marin Rodrigues <josch@mister-muffin.de> | 2022-12-22 08:15:10 +0100 |
commit | aa3c69cf9751072a461a962f7b81324b18f9dfec (patch) | |
tree | 3698cb99d6f54255c172a3ff0abbc6d386a68734 /.gitlab-ci.yml | |
parent | 1b738bd70a9e9d24d159763c0ef5efe11b561718 (diff) | |
download | debvm-aa3c69cf9751072a461a962f7b81324b18f9dfec.tar.gz |
.gitlab-ci.yml: wait for system to be ready for ssh connections before continueing
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6ec557..65bd73d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,9 +24,22 @@ simpletest: script: - apt-get update - apt-get dist-upgrade --yes - - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client qemu-kvm + - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client qemu-kvm sleepenh - ssh-keygen -f ~/.ssh/id -N '' - ./debvm-create -k ~/.ssh/id.pub -r $RELEASE - timeout 120s ./debvm-run -s 2222 & - - sleep 15 + - | + set -x + timeout=5 + ts=$(sleepenh 0 || [ $? -eq 1 ]) + for i in $(seq 10); do + rv=0 + ssh -o StrictHostKeyChecking=no -o ConnectTimeout="$timeout" -i ~/.ssh/id -p 2222 root@localhost echo success || rev=$? + test $rv -eq 0 && break + ts=$(sleepenh "$ts" "$timeout" || [ $? -eq 1 ]); + if test $i -eq 10; then + echo "timeout reached" >&2 + exit 1 + fi + done - ssh -o StrictHostKeyChecking=no -i ~/.ssh/id -p 2222 root@localhost poweroff |