Fix CI and test UEFI too

This commit is contained in:
Timothy Redaelli 2021-08-05 17:17:51 +02:00
parent 78234c8bb6
commit 43a1d7d58d

View file

@ -1,4 +1,4 @@
image: debian:latest
image: debian:stretch
build:
stage: build
@ -7,12 +7,13 @@ build:
- DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retires=10 install --no-install-recommends -qq libguestfs-tools busybox linux-image-amd64 gnupg1 openssh-client
- ssh-keygen -q -N '' -f ~/.ssh/id_rsa
script:
- 'LIBGUESTFS_BACKEND=direct virt-builder --gpg /usr/bin/gpg1 --arch x86_64 debian-9 -o debian.raw --root-password password:root --ssh-inject root --install wget,ca-certificates --firstboot-command "dpkg-reconfigure openssh-server"'
- curl -fOL https://cdimage.debian.org/cdimage/cloud/buster/latest/debian-10-nocloud-amd64.qcow2
- 'LIBGUESTFS_BACKEND=direct virt-customize -a debian-10-nocloud-amd64.qcow2 --root-password password:root --ssh-inject root --install wget,ca-certificates --firstboot-command "dpkg-reconfigure -f noninteractive openssh-server"'
after_script:
- mv ~/.ssh/id_rsa id_rsa
cache:
paths:
- debian.raw
- debian-10-nocloud-amd64.qcow2
- id_rsa
policy: push
@ -25,15 +26,38 @@ build:
- mkdir ~/.ssh
- mv id_rsa ~/.ssh/id_rsa
- printf '%s\n\t' 'Host *' 'ServerAliveInterval 15' 'UserKnownHostsFile /dev/null' 'StrictHostKeyChecking no' 'CheckHostIP no' > ~/.ssh/config
- qemu-system-x86_64 -m 256 -daemonize -drive file=debian.raw,if=virtio -net nic -net user,hostfwd=tcp::10022-:22 -display none -vga none
- sleep 60
- qemu-system-x86_64 -m 256 -daemonize -drive file=debian-10-nocloud-amd64.qcow2,if=virtio -net nic -net user,hostfwd=tcp::10022-:22 -display none -vga none -serial file:/tmp/serial
- 'tail -f /tmp/serial &'
- sleep 120
- scp -P 10022 vps2arch root@127.0.0.1:vps2arch
- ssh -p 10022 root@127.0.0.1 "chmod +x vps2arch"
dependencies:
- build
cache:
paths:
- debian.raw
- debian-10-nocloud-amd64.qcow2
- id_rsa
policy: pull
.tests_uefi:
retry: 1
stage: test
before_script:
- apt-get update -y
- DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retires=10 install --no-install-recommends -qq qemu-system-x86 openssh-client ovmf sshpass
- mkdir ~/.ssh
- mv id_rsa ~/.ssh/id_rsa
- printf '%s\n\t' 'Host *' 'ServerAliveInterval 15' 'UserKnownHostsFile /dev/null' 'StrictHostKeyChecking no' 'CheckHostIP no' > ~/.ssh/config
- qemu-system-x86_64 -m 256 -daemonize -bios /usr/share/OVMF/OVMF_CODE.fd -drive file=debian-10-nocloud-amd64.qcow2,if=virtio -net nic -net user,hostfwd=tcp::10022-:22 -display none -vga none -serial file:/tmp/serial
- 'tail -f /tmp/serial &'
- sleep 120
- scp -P 10022 vps2arch root@127.0.0.1:vps2arch
- ssh -p 10022 root@127.0.0.1 "chmod +x vps2arch"
dependencies:
- build
cache:
paths:
- debian-10-nocloud-amd64.qcow2
- id_rsa
policy: pull
@ -57,3 +81,10 @@ test_syslinux:
- 'ssh -p 10022 root@127.0.0.1 "./vps2arch -b syslinux && sync ; reboot -f" || true'
- sleep 600
- sshpass -proot ssh -p 10022 root@127.0.0.1 test -f /etc/arch-release
test_default_uefi:
extends: .tests_uefi
script:
- 'ssh -p 10022 root@127.0.0.1 "./vps2arch && sync ; reboot -f" || true'
- sleep 600
- sshpass -proot ssh -p 10022 root@127.0.0.1 test -f /etc/arch-release