Skip to content

use virtio bus for CDs #515

use virtio bus for CDs

use virtio bus for CDs #515

Workflow file for this run

name: Build
on:
push:
branches-ignore:
- main
jobs:
restvirt:
name: Restvirt
runs-on: self-hosted
steps:
- name: Set up Python 3.10.6
id: python
uses: actions/setup-python@v4
with:
python-version: 3.10.6
- name: Check out code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libvirt-dev
pip install -r requirements.txt -r requirements-dev.txt
- name: Lint
run: |
black --check --diff --color ./
isort --check --diff --color ./
- name: Unit Tests
run: |
tmp_dir=$(mktemp -d)
chmod -R 0711 "${tmp_dir}"
sudo iptables -P FORWARD ACCEPT
sudo ${{ steps.python.outputs.python-path }} -m pytest tests/unit
- name: Build Snap
run: |
sudo snap install --classic snapcraft
sudo usermod --append --groups lxd $(whoami)
sudo lxd init --auto
snapcraft --use-lxd
- name: Integration Tests
run: |
sudo snap install --dangerous minivirt*.snap
sudo snap connect minivirt:network-control
sudo snap connect minivirt:firewall-control
sudo snap connect minivirt:libvirt
cat << EOF | sudo tee -a /var/snap/minivirt/common/ca.crt
-----BEGIN CERTIFICATE-----
MIICCjCCAY+gAwIBAgIUSl7KWjtgvG9rNMz7hhYRKy5LsB8wCgYIKoZIzj0EAwIw
RDELMAkGA1UEBhMCREUxDzANBgNVBAgMBkJlcmxpbjERMA8GA1UECgwIbWluaXZp
cnQxETAPBgNVBAMMCG1pbml2aXJ0MB4XDTIzMDcwODIzMjUyMFoXDTMzMDcwNTIz
MjUyMFowRDELMAkGA1UEBhMCREUxDzANBgNVBAgMBkJlcmxpbjERMA8GA1UECgwI
bWluaXZpcnQxETAPBgNVBAMMCG1pbml2aXJ0MHYwEAYHKoZIzj0CAQYFK4EEACID
YgAEI3nOFzsWO3w8qGLSjDSiX3OWCH7qBRcTjt/luPjXLqe3DVcFQPLYN31PaggR
o0jCjrKklxqtzHmmMdMRnyoRPbQOQPRa9N177a2s97M5ZJQVkeFL8WRUf7x1P0Cd
SZvco0IwQDAdB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WaBRZMLuhFNixMsSmmHHIqGlvIrWFa5MiN6
RaZ7aTGa/HMKZAIxAPRJZ11Vp1BNBszSiswk32hsck4JP9h1hn00IMu33iK0+q22
Jv73oZy3l4gQmLlCDg==
-----END CERTIFICATE-----
EOF
cat << EOF | sudo tee -a /var/snap/minivirt/common/server.key
-----BEGIN PRIVATE KEY-----
MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCIJQuTNENeEnhjCtdV
GXoFgh69LQ+Ms5B/i0jWMSqMALL26uG6NNM4nvHgIMbChKGhZANiAAQdZX14vf96
CmpyBNowM9aBrbGl9NkJzrrI3GRUY+zDkFYT8Re9a25QKMOYdagc52tu3uIj2UD1
WdLCUL094i9fiUrZ1c06mfcYmVnwmSOllkGDSbFpS3q9AzIZJyhw44A=
-----END PRIVATE KEY-----
EOF
sudo snap set minivirt controller.args='--debug -b :8093 -c $SNAP_COMMON --server-cert $SNAP_COMMON/server.crt --server-key $SNAP_COMMON/server.key --client-ca-cert $SNAP_COMMON/ca.crt'
sudo snap start --enable minivirt.unbound
sudo snap start --enable minivirt.controller
sudo minivirt.register -a 127.0.0.1:8093 --name default -b 127.0.0.1:8099 --client-cert /var/snap/minivirt/common/server.crt --client-key /var/snap/minivirt/common/server.key --server-ca-cert /var/snap/minivirt/common/ca.crt
sudo snap set minivirt daemon.args='--debug -a 127.0.0.1:8093 -b 127.0.0.1:8099 -c $SNAP_COMMON --client-cert $SNAP_COMMON/server.crt --client-key $SNAP_COMMON/server.key --server-ca-cert $SNAP_COMMON/ca.crt'
sudo snap start --enable minivirt.daemon
sleep 10
if ! sudo ${{ steps.python.outputs.python-path }} -m pytest tests/integration ; then
sudo journalctl
exit 1
fi
# sleep 5
# snap services minivirt
# sudo journalctl -e
# sudo apt install -y net-tools
# sudo netstat -tulpen
# sudo ${{ steps.python.outputs.python-path }} -m pytest tests/integration
# sudo journalctl -e
# sudo netstat -tulpen
# - name: Build
# run: |
# docker build --target test -t restvirt-tests .
# docker build -t restvirt .
# - name: Test
# run: |
# tmp_dir=$(mktemp -d)
# chmod -R 0711 "${tmp_dir}"
# iptables -P FORWARD ACCEPT
# docker run --rm --cap-add=NET_ADMIN --network host -t -v /var/run/libvirt:/var/run/libvirt -v "${tmp_dir}":/data/restvirt/images restvirt-tests --pool-dir "${tmp_dir}"