From eca678290ac4f28f610ef05570ac6df338839490 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 14:37:06 +0100 Subject: CI: Use local ssh key --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2ce36c..6c8dbc5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ codespell: ts=$(sleepenh 0 || [ $? -eq 1 ]) for i in $(seq 30); do rv=0 - ssh $sshopt -o ConnectTimeout="$timeout" -i ~/.ssh/id -p 2222 root@localhost echo success || rv=$? + ssh $sshopt -o ConnectTimeout="$timeout" -i ssh_id -p 2222 root@localhost echo success || rv=$? test $rv -eq 0 && break ts=$(sleepenh "$ts" "$timeout" || [ $? -eq 1 ]); if test $i -eq 30; then @@ -33,7 +33,7 @@ codespell: exit 1 fi done - - ssh $sshopt -i ~/.ssh/id -p 2222 root@localhost poweroff + - ssh $sshopt -i ssh_id -p 2222 root@localhost poweroff release_test: extends: .test_script @@ -51,8 +51,8 @@ release_test: - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-kvm - - ssh-keygen -f ~/.ssh/id -N '' - - ./debvm-create -k ~/.ssh/id.pub -r "$RELEASE" + - ssh-keygen -f ssh_id -N '' + - ./debvm-create -k ssh_id.pub -r "$RELEASE" arch_test: extends: .test_script @@ -75,5 +75,5 @@ arch_test: - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-system binfmt-support arch-test qemu-user-static - - ssh-keygen -f ~/.ssh/id -N '' - - ./debvm-create -k ~/.ssh/id.pub -a $ARCHITECTURE + - ssh-keygen -f ssh_id -N '' + - ./debvm-create -k ssh_id.pub -a "$ARCHITECTURE" -- cgit v1.2.3 From 60dc263bfe8a05541feed56f00fef7ac15dc49cf Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 14:38:30 +0100 Subject: CI: fix indention --- .gitlab-ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c8dbc5..b8bb17d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,12 +41,12 @@ release_test: parallel: matrix: - RELEASE: - - sid - - bookworm - - bullseye - - buster - - stretch - - jessie + - sid + - bookworm + - bullseye + - buster + - stretch + - jessie before_script: - apt-get update - apt-get dist-upgrade --yes @@ -60,13 +60,13 @@ arch_test: parallel: matrix: - ARCHITECTURE: - - arm64 - - armhf - - i386 - - mips64el - - mipsel - - ppc64el - - s390x + - arm64 + - armhf + - i386 + - mips64el + - mipsel + - ppc64el + - s390x before_script: - | if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then -- cgit v1.2.3 From 8899775ccfce4b0b9373b3e3bd00220cca349f93 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 14:48:35 +0100 Subject: CI: drop stage (not needed) --- .gitlab-ci.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b8bb17d..8af5b41 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,6 @@ image: debian:sid-slim shellcheck: - stage: test script: - apt-get update - apt-get dist-upgrade --yes @@ -9,7 +8,6 @@ shellcheck: - shellcheck debvm-* codespell: - stage: test script: - apt-get update - apt-get dist-upgrade --yes @@ -37,7 +35,6 @@ codespell: release_test: extends: .test_script - stage: test parallel: matrix: - RELEASE: @@ -56,7 +53,6 @@ release_test: arch_test: extends: .test_script - stage: test parallel: matrix: - ARCHITECTURE: -- cgit v1.2.3 From af4f1eb0cd386e7d6aa06a097998f4bbcbf9bb43 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 20:55:37 +0100 Subject: Move tests to tests/create-and-run.sh (Closes: #4) --- .gitlab-ci.yml | 31 ++++--------------------------- tests/create-and-run.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 27 deletions(-) create mode 100755 tests/create-and-run.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8af5b41..5d5f375 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,27 +14,7 @@ codespell: - apt-get --no-install-recommends --yes install codespell - codespell debvm-* -.test_script: - script: - - timeout 240s ./debvm-run -s 2222 & - - | - timeout=5 - sshopt="-o StrictHostKeyChecking=no $(if test "$RELEASE" = jessie; then echo -o PubkeyAcceptedKeyTypes=+ssh-rsa; fi)" - ts=$(sleepenh 0 || [ $? -eq 1 ]) - for i in $(seq 30); do - rv=0 - ssh $sshopt -o ConnectTimeout="$timeout" -i ssh_id -p 2222 root@localhost echo success || rv=$? - test $rv -eq 0 && break - ts=$(sleepenh "$ts" "$timeout" || [ $? -eq 1 ]); - if test $i -eq 30; then - echo "timeout reached" >&2 - exit 1 - fi - done - - ssh $sshopt -i ssh_id -p 2222 root@localhost poweroff - release_test: - extends: .test_script parallel: matrix: - RELEASE: @@ -44,15 +24,13 @@ release_test: - buster - stretch - jessie - before_script: + script: - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-kvm - - ssh-keygen -f ssh_id -N '' - - ./debvm-create -k ssh_id.pub -r "$RELEASE" + - PATH=.:$PATH ./tests/create-and-run.sh -r "$RELEASE" arch_test: - extends: .test_script parallel: matrix: - ARCHITECTURE: @@ -63,7 +41,7 @@ arch_test: - mipsel - ppc64el - s390x - before_script: + script: - | if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc @@ -71,5 +49,4 @@ arch_test: - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-system binfmt-support arch-test qemu-user-static - - ssh-keygen -f ssh_id -N '' - - ./debvm-create -k ssh_id.pub -a "$ARCHITECTURE" + - PATH=.:$PATH ./tests/create-and-run.sh -a "$ARCHITECTURE" diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh new file mode 100755 index 0000000..dfd4022 --- /dev/null +++ b/tests/create-and-run.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# shellcheck disable=SC2086 + +set -ex + +cleanup() { + rm -f ssh_id ssh_id.pub test.ext2 +} + +trap cleanup EXIT INT TERM QUIT + +ssh-keygen -f ssh_id -N '' +debvm-create -k ssh_id.pub -o test.ext2 "$@" + +timeout 240s debvm-run -s 2222 -i test.ext2 & +timeout=5 +sshopt="-o StrictHostKeyChecking=no $(if test "$2" = jessie; then echo -o PubkeyAcceptedKeyTypes=+ssh-rsa; fi)" +ts=$(sleepenh 0 || [ $? -eq 1 ]) +for i in $(seq 30); do + rv=0 + ssh $sshopt -o ConnectTimeout="$timeout" -i ssh_id -p 2222 root@localhost echo success || rv=$? + test $rv -eq 0 && break + ts=$(sleepenh "$ts" "$timeout" || [ $? -eq 1 ]); + if test "$i" -eq 30; then + echo "timeout reached" >&2 + exit 1 + fi +done +ssh $sshopt -i ssh_id -p 2222 root@localhost poweroff -- cgit v1.2.3 From c9a0ca87fc9b3bdb3350663be663835fcbf15190 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 23:09:13 +0100 Subject: Use ext4 for test image extension --- tests/create-and-run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh index dfd4022..4b5d986 100755 --- a/tests/create-and-run.sh +++ b/tests/create-and-run.sh @@ -5,15 +5,15 @@ set -ex cleanup() { - rm -f ssh_id ssh_id.pub test.ext2 + rm -f ssh_id ssh_id.pub test.ext4 } trap cleanup EXIT INT TERM QUIT ssh-keygen -f ssh_id -N '' -debvm-create -k ssh_id.pub -o test.ext2 "$@" +debvm-create -k ssh_id.pub -o test.ext4 "$@" -timeout 240s debvm-run -s 2222 -i test.ext2 & +timeout 240s debvm-run -s 2222 -i test.ext4 & timeout=5 sshopt="-o StrictHostKeyChecking=no $(if test "$2" = jessie; then echo -o PubkeyAcceptedKeyTypes=+ssh-rsa; fi)" ts=$(sleepenh 0 || [ $? -eq 1 ]) -- cgit v1.2.3 From 6f6f3d632c199fd56e5063d6e5ecab13ea69ac55 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 23:14:34 +0100 Subject: Simplify .gitlab-ci.yml --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d5f375..3d91676 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,10 +42,7 @@ arch_test: - ppc64el - s390x script: - - | - if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then - mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc - fi + - test -e /proc/sys/fs/binfmt_misc/status || mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-system binfmt-support arch-test qemu-user-static -- cgit v1.2.3 From 99374d17fc20abc1659d46280971376f795babaf Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Fri, 23 Dec 2022 23:40:06 +0100 Subject: Fix image name for fsck --- debvm-create | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debvm-create b/debvm-create index a8f164d..7cc5e31 100755 --- a/debvm-create +++ b/debvm-create @@ -225,4 +225,4 @@ truncate -s "$SIZE" "$IMAGE" /sbin/resize2fs "$IMAGE" /sbin/tune2fs -L debvm -i 0 -O extents,uninit_bg,dir_index,has_journal "$IMAGE" # Must fsck after tune2fs: https://ext4.wiki.kernel.org/index.php/UpgradeToExt4 -/sbin/fsck.ext4 -fDp rootfs.ext2 +/sbin/fsck.ext4 -fDp "$IMAGE" -- cgit v1.2.3 From dcf46b1c7602bb2ddd13e9bcf1fb66a8690f4864 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Tue, 27 Dec 2022 16:20:54 +0100 Subject: test script: Use positional arguments Reported-by: Helmut Grohne --- .gitlab-ci.yml | 4 ++-- tests/create-and-run.sh | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3d91676..6427330 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,7 @@ release_test: - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-kvm - - PATH=.:$PATH ./tests/create-and-run.sh -r "$RELEASE" + - PATH=.:$PATH ./tests/create-and-run.sh $(dpkg --print-architecture) "$RELEASE" arch_test: parallel: @@ -46,4 +46,4 @@ arch_test: - apt-get update - apt-get dist-upgrade --yes - apt-get --no-install-recommends --yes install e2fsprogs genext2fs mmdebstrap openssh-client sleepenh qemu-system binfmt-support arch-test qemu-user-static - - PATH=.:$PATH ./tests/create-and-run.sh -a "$ARCHITECTURE" + - PATH=.:$PATH ./tests/create-and-run.sh "$ARCHITECTURE" sid diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh index 4b5d986..0e2a3ca 100755 --- a/tests/create-and-run.sh +++ b/tests/create-and-run.sh @@ -2,6 +2,11 @@ # shellcheck disable=SC2086 +if test "$#" -ne 2; then + echo "$(basename $0) takes two positional arguments. architecture and release" 1>&2 + exit 1 +fi + set -ex cleanup() { @@ -11,7 +16,7 @@ cleanup() { trap cleanup EXIT INT TERM QUIT ssh-keygen -f ssh_id -N '' -debvm-create -k ssh_id.pub -o test.ext4 "$@" +debvm-create -k ssh_id.pub -o test.ext4 -a "$1" -r "$2" timeout 240s debvm-run -s 2222 -i test.ext4 & timeout=5 -- cgit v1.2.3