Continuous integration/Qemu

Agent
To provision a new agent, follow Nova Resource:Integration/Setup to set up an agent for Jenkins.

Qemu
To setup Qemu and the VM images, apply the Puppet role `role::ci::agent::qemu` via Horizon. It will: - generate a ssh key pair - create an image based on the Debian official cloud images - customize the image to enable ssh and add extra Debian packages

Puppet invokes. It is provisioned by Puppet from.

The image can be manually booted using:

qemu-system-x86_64 -nographic -m 4G -snapshot /srv/vm-images/debian-11-ci.qcow2

Wait for the bootloader to pass, then once " " appears, enter " ".

Use  to exit from Qemu.

Launch for remote control
This is how Jenkins jobs launch the VM, rather than getting an interactive shell directly from Qemu, we we launch the Qemu with an SSH port exposed, and login that way:

you@agent$ qemu-system-x86_64 -device virtio-net,netdev=user.0 -netdev user,id=user.0,hostfwd=tcp::4293-:22 -smp 4 -m 4096 -nographic -snapshot /srv/vm-images/debian-11-ci.qcow2 … you@agent$ install -m 600 /srv/vm-images/sshkey_qemu_root_v1 root.key you@agent$ ssh -i ./root.key -p 4293 root@localhost … root@img# … root@img# exit
 * 1) Terminal 1 (launch guest VM)
 * 1) Terminal 2 (create copy of key, then open shell via ssh)

Jenkins Jobs
The Jenkins jobs currently use https://gerrit.wikimedia.org/g/integration/config/+/master/jjb/qemu-run.bash

After publishing a new image, update this script to point to the new image version.

When making changes to this script, you will need to regenerate the Jenkins jobs that embed this script for the changes to take effect. (see Continuous integration/Jenkins job builder).