From 43b02ce4cb9fd8e94869b8aaf30273f488cdae5f Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Fri, 19 Jan 2024 12:31:18 +0900 Subject: [PATCH] GitHub Actions: use Linux runners for nested virt "Larger" runners are no longer needed for Linux with nested virt. Replaces PR 3382 Signed-off-by: Akihiro Suda --- .github/workflows/cgroup2.yaml | 20 ++++++++++++++++++-- hack/ci/Vagrantfile | 9 +++------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cgroup2.yaml b/.github/workflows/cgroup2.yaml index 29185d9588..134815f43e 100644 --- a/.github/workflows/cgroup2.yaml +++ b/.github/workflows/cgroup2.yaml @@ -14,8 +14,7 @@ permissions: jobs: docker: name: Cgroup v2 - # nested virtualization is only available on macOS hosts - runs-on: macos-12 + runs-on: ubuntu-22.04 timeout-minutes: 30 strategy: fail-fast: false @@ -23,6 +22,7 @@ jobs: provider: [docker, podman] rootless: ["rootful", "rootless"] env: + VAGRANT_DEFAULT_PROVIDER: libvirt KIND_EXPERIMENTAL_PROVIDER: "${{ matrix.provider }}" ROOTLESS: "${{ matrix.rootless }}" HELPER: "./hack/ci/vagrant-helper.sh" @@ -31,6 +31,22 @@ jobs: - name: Check out code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + # https://github.com/containerd/containerd/blob/420503072e58f27a7192ddea4e6e41dced911cb9/.github/workflows/ci.yml#L569-L581 + - name: Set up vagrant + run: | + # Canonical's Vagrant 2.2.19 dpkg cannot download Fedora 38 image: https://bugs.launchpad.net/vagrant/+bug/2017828 + # 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 + curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg + 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 + sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list + sudo apt-get update + sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant + sudo systemctl enable --now libvirtd + sudo apt-get build-dep -y vagrant ruby-libvirt + sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev + sudo chown $(whoami) /var/run/libvirt/libvirt-sock + vagrant plugin install vagrant-libvirt + - name: Boot Fedora run: | ln -sf ./hack/ci/Vagrantfile ./Vagrantfile diff --git a/hack/ci/Vagrantfile b/hack/ci/Vagrantfile index a1b83b0c63..5ebdea75b8 100644 --- a/hack/ci/Vagrantfile +++ b/hack/ci/Vagrantfile @@ -7,12 +7,9 @@ Vagrant.configure("2") do |config| # so we specify the URL explicitly. # Mirrors can be found at here: https://admin.fedoraproject.org/mirrormanager/mirrors/Fedora/37/x86_64 config.vm.box = "dummy" - config.vm.box_url = "https://iad.mirror.rackspace.com/fedora/releases/37/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-37-1.7.x86_64.vagrant-virtualbox.box" - # macOS github actions runners have 3 cores and 14 GB of ram - # assume some ram is needed for the host environment but very little CPU - # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners - memory = 10240 - cpus = 3 + config.vm.box_url = "https://iad.mirror.rackspace.com/fedora/releases/37/Cloud/x86_64/images/Fedora-Cloud-Base-Vagrant-37-1.7.x86_64.vagrant-libvirt.box" + memory = 4096 + cpus = 2 config.vm.provider :virtualbox do |v| v.memory = memory v.cpus = cpus