diff --git a/Jenkinsfile b/Jenkinsfile index 1df7d2e..ab0f895 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,14 +7,14 @@ pipeline { stage('Unit Tests (bullseye)') { steps { catchError(stageResult: 'FAILURE') { - sh 'sudo ./test-nspawn bullseye' + sh './test-debvm bullseye' } } } stage('Unit Tests (bookworm)') { steps { catchError(stageResult: 'FAILURE') { - sh 'sudo ./test-nspawn bookworm' + sh './test-debvm bookworm' } } } diff --git a/test-debvm b/test-debvm new file mode 100755 index 0000000..8b96755 --- /dev/null +++ b/test-debvm @@ -0,0 +1,20 @@ +#!/bin/sh -ex +# USAGE : ./test-debvm bookworm + +if [ $1 = bullseye ] || [ $1 = bookworm ] +then + SUITE=$1 + debvm-create --release=$SUITE --size=10G --sshkey=$HOME/.ssh/id_rsa.pub -- --include=ca-certificates,gnupg2,linux-image-generic,locales-all,postgresql,sudo,git,ansible,make --hook-dir=/usr/share/mmdebstrap/hooks/9pmount + debvm-run -g --sshport 2222 -- -daemonize -display none -virtfs "local,path=.,mount_tag=publik-devinst,security_model=none" + debvm-waitssh 2222 + ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2222 root@localhost "cd /media/publik-devinst;./test-debvm run-tests" + kill `ps ax | grep "qemu-system-x86_64" | awk 'NR==1{print $1}'` + rm rootfs.ext4 +elif [ $1 = 'run-tests' ] +then + adduser --disabled-password --gecos "" testuser + usermod -a -G sudo testuser + echo 'testuser ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + PORT=`pg_lsclusters | tail -n1 | awk '{ print $3 }'` + su testuser -l -c 'cd /media/publik-devinst; ansible-playbook -e "postgresql_port=$PORT" -i inventory.yml install.yml' +fi