ci: use debvm (#72899)
gitea/publik-devinst/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Emmanuel Cazenave 2024-02-02 14:20:00 +01:00
parent fc6364fb7f
commit 1d87fb8a6b
2 changed files with 22 additions and 2 deletions

4
Jenkinsfile vendored
View File

@ -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'
}
}
}

20
test-debvm Executable file
View File

@ -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