Skip to content

Commit 31d951b

Browse files
committed
Run vagrant integration tests as github actions
Signed-off-by: Derek McGowan <[email protected]>
1 parent ae71819 commit 31d951b

2 files changed

Lines changed: 82 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,85 @@ jobs:
528528
${{github.workspace}}/report/*.xml
529529
${{github.workspace}}/report/*.log
530530
531+
integration-vagrant:
532+
name: Vagrant integration
533+
runs-on: ubuntu-22.04
534+
timeout-minutes: 60
535+
needs: [project, linters, protos, man]
536+
537+
strategy:
538+
fail-fast: false
539+
matrix:
540+
box:
541+
- fedora/39-cloud-base
542+
# We have to keep EL8 to test old glibc, cgroup, kernel, etc.
543+
# The image was changed from rockylinux/8 to almalinux/8,
544+
# as the former one no longer works:
545+
# https://github.com/containerd/containerd/pull/10297
546+
- almalinux/8
547+
- rockylinux/[email protected]
548+
env:
549+
BOX: ${{ matrix.box }}
550+
551+
steps:
552+
- name: Show the host info
553+
run: |
554+
set -x
555+
uname -a
556+
cat /etc/os-release
557+
cat /proc/cpuinfo
558+
free -mt
559+
- uses: actions/checkout@v4
560+
- uses: actions/cache@v4
561+
with:
562+
path: /root/.vagrant.d
563+
key: vagrant-${{ matrix.box }}
564+
- name: Set up vagrant
565+
run: |
566+
# Canonical's Vagrant 2.2.19 dpkg cannot download Fedora 38 image: https://bugs.launchpad.net/vagrant/+bug/2017828
567+
# So we have to install Vagrant >= 2.3.1 from the upstream: https://github.com/opencontainers/runc/blob/v1.1.8/.cirrus.yml#L41-L49
568+
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
569+
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
570+
sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
571+
sudo apt-get update
572+
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant
573+
sudo systemctl enable --now libvirtd
574+
sudo apt-get build-dep -y vagrant ruby-libvirt
575+
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
576+
sudo vagrant plugin install vagrant-libvirt
577+
- name: Boot VM
578+
run: sudo BOX=$BOX vagrant up --no-tty
579+
- name: test-integration
580+
run: sudo BOX=$BOX vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-integration
581+
- name: test-cri-integration
582+
run: sudo BOX=$BOX vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-cri-integration
583+
- name: test-cri
584+
run: sudo BOX=$BOX vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-cri
585+
586+
tests-cri-in-userns:
587+
name: "CRI-in-UserNS"
588+
589+
runs-on: ubuntu-22.04
590+
timeout-minutes: 40
591+
needs: [project, linters, protos, man]
592+
593+
steps:
594+
- uses: actions/checkout@v4
595+
- name: Set up cgroup v2 delegation
596+
run: |
597+
sudo mkdir -p /etc/systemd/system/[email protected]
598+
cat <<EOF | sudo tee /etc/systemd/system/[email protected]/delegate.conf
599+
[Service]
600+
Delegate=cpu cpuset io memory pids
601+
EOF
602+
sudo systemctl daemon-reload
603+
- name: Build cri-in-userns image
604+
run: podman build --target cri-in-userns -t cri-in-userns -f ./contrib/Dockerfile.test .
605+
- name: Run cri-in-userns image
606+
# Rootless Podman is used for testing CRI-in-UserNS
607+
# (We could use rootless Docker or rootless nerdctl, but we are using Podman here because it is preinstalled)
608+
run: podman run --rm --privileged cri-in-userns
609+
531610
tests-mac-os:
532611
name: MacOS unit tests
533612
runs-on: macos-12

Vagrantfile

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# Vagrantfile for Fedora and EL
1919
Vagrant.configure("2") do |config|
20-
config.vm.box = ENV["BOX"] ? ENV["BOX"].split("@")[0] : "fedora/37-cloud-base"
20+
config.vm.box = ENV["BOX"] ? ENV["BOX"].split("@")[0] : "fedora/39-cloud-base"
2121
# BOX_VERSION is deprecated. Use "BOX=<BOX>@<BOX_VERSION>".
2222
config.vm.box_version = ENV["BOX_VERSION"] || (ENV["BOX"].split("@")[1] if ENV["BOX"])
2323

@@ -29,11 +29,13 @@ Vagrant.configure("2") do |config|
2929
v.cpus = cpus
3030
# Needs env var VAGRANT_EXPERIMENTAL="disks"
3131
o.vm.disk :disk, size: "#{disk_size}GB", primary: true
32+
v.customize ["modifyvm", :id, "--firmware", "efi"]
3233
end
3334
config.vm.provider :libvirt do |v|
3435
v.memory = memory
3536
v.cpus = cpus
3637
v.machine_virtual_size = disk_size
38+
v.loader = "/usr/share/OVMF/OVMF_CODE.fd"
3739
end
3840

3941
config.vm.synced_folder ".", "/vagrant", type: "rsync"
@@ -326,29 +328,4 @@ EOF
326328
SHELL
327329
end
328330

329-
# Rootless Podman is used for testing CRI-in-UserNS
330-
# (We could use rootless nerdctl, but we are using Podman here because it is available in dnf)
331-
config.vm.provision "install-rootless-podman", type: "shell", run: "never" do |sh|
332-
sh.upload_path = "/tmp/vagrant-install-rootless-podman"
333-
sh.inline = <<~SHELL
334-
#!/usr/bin/env bash
335-
set -eux -o pipefail
336-
# Delegate cgroup v2 controllers to rootless
337-
mkdir -p /etc/systemd/system/[email protected]
338-
cat > /etc/systemd/system/[email protected]/delegate.conf << EOF
339-
[Service]
340-
Delegate=yes
341-
EOF
342-
systemctl daemon-reload
343-
# Install Podman
344-
dnf install -y podman
345-
# Configure Podman to resolve `golang` to `docker.io/library/golang`
346-
mkdir -p /etc/containers
347-
cat > /etc/containers/registries.conf <<EOF
348-
[registries.search]
349-
registries = ['docker.io']
350-
EOF
351-
SHELL
352-
end
353-
354331
end

0 commit comments

Comments
 (0)