Skip to content

Commit 0985f7a

Browse files
author
Kazuyoshi Kato
committed
ci: Use Vagrant on ubuntu-latest-4-cores
This Vagrant on Mac job has been broken for a while. Instead this change moves Vagrant to larger Linux workers that provide nested virtualization. Our main branch did something similar (moving to Cirrus CI to larger GitHub-hosted runners) already as #8919. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent e63636a commit 0985f7a

2 files changed

Lines changed: 45 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ jobs:
502502
503503
vagrant:
504504
name: Vagrant
505-
# nested virtualization is only available on macOS hosts
506-
runs-on: macos-12
505+
runs-on: ubuntu-latest-4-cores
507506
timeout-minutes: 45
508507
needs: [linters, protos, man]
509508
strategy:
@@ -516,52 +515,58 @@ jobs:
516515
box: ["fedora/37-cloud-base", "rockylinux/8"]
517516
env:
518517
GOTEST: gotestsum --
518+
BOX: ${{ matrix.box }}
519+
519520
steps:
520521
- uses: actions/checkout@v3
521522

522523
- name: "Cache ~/.vagrant.d/boxes"
523524
uses: actions/cache@v3
524525
with:
525-
path: ~/.vagrant.d/boxes
526-
key: vagrant-${{ hashFiles('Vagrantfile*') }}
526+
path: /root/.vagrant.d
527+
key: vagrant-${{ matrix.box }}
528+
529+
- name: Set up Vagrant
530+
run: |
531+
# Canonical's Vagrant 2.2.19 dpkg cannot download Fedora 38 image: https://bugs.launchpad.net/vagrant/+bug/2017828
532+
# 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
533+
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
534+
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
535+
sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
536+
sudo apt-get update
537+
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant
538+
sudo systemctl enable --now libvirtd
539+
sudo apt-get build-dep -y vagrant ruby-libvirt
540+
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
541+
sudo vagrant plugin install vagrant-libvirt vagrant-scp
527542
528543
- name: Vagrant start
529-
env:
530-
BOX: ${{ matrix.box }}
531544
run: |
532545
if [ "$BOX" = "rockylinux/8" ]; then
533546
# The latest version 5.0.0 seems 404 (as of March 30, 2022)
534547
export BOX_VERSION="4.0.0"
535548
fi
536-
# Retry if it fails (download.fedoraproject.org returns 404 sometimes)
537-
vagrant up || vagrant up
549+
sudo BOX=$BOX vagrant up --no-tty
538550
539551
- name: Integration
540552
env:
541553
RUNC_FLAVOR: ${{ matrix.runc }}
542554
SELINUX: Enforcing
543555
GOTESTSUM_JUNITFILE: /tmp/test-integration-junit.xml
544-
run: vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-integration
556+
run: sudo BOX=$BOX vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-integration
545557

546558
- name: CRI test
547559
env:
548560
RUNC_FLAVOR: ${{ matrix.runc }}
549561
SELINUX: Enforcing
550562
REPORT_DIR: /tmp/critestreport
551-
run: vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-cri
552-
553-
- name: Collect the VM's IP address for Docker Hub's throttling issue
554-
if: failure()
555-
run: vagrant ssh -- curl https://api64.ipify.org/
563+
run: sudo BOX=$BOX vagrant up --provision-with=selinux,install-runc,install-gotestsum,test-cri
556564

557565
- name: Get test reports
558566
if: always()
559567
run: |
560-
set -e
561-
vagrant plugin install vagrant-vbguest
562-
vagrant plugin install vagrant-scp
563-
vagrant scp :/tmp/test-integration-junit.xml "${{ github.workspace }}/"
564-
vagrant scp :/tmp/critestreport "${{ github.workspace }}/critestreport"
568+
sudo vagrant scp :/tmp/test-integration-junit.xml "${{ github.workspace }}/"
569+
sudo vagrant scp :/tmp/critestreport "${{ github.workspace }}/critestreport"
565570
- uses: actions/upload-artifact@v3
566571
if: always()
567572
with:
@@ -573,8 +578,7 @@ jobs:
573578
574579
cgroup2-misc:
575580
name: CGroupsV2 - rootless CRI test
576-
# nested virtualization is only available on macOS hosts
577-
runs-on: macos-12
581+
runs-on: ubuntu-latest-4-cores
578582
timeout-minutes: 45
579583
needs: [linters, protos, man]
580584
steps:
@@ -583,22 +587,31 @@ jobs:
583587
- name: "Cache ~/.vagrant.d/boxes"
584588
uses: actions/cache@v3
585589
with:
586-
path: ~/.vagrant.d/boxes
590+
path: /root/.vagrant.d/boxes
587591
key: vagrant-${{ hashFiles('Vagrantfile*') }}
588592

593+
- name: Set up Vagrant
594+
run: |
595+
# Canonical's Vagrant 2.2.19 dpkg cannot download Fedora 38 image: https://bugs.launchpad.net/vagrant/+bug/2017828
596+
# 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
597+
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
598+
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
599+
sudo sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list
600+
sudo apt-get update
601+
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant
602+
sudo systemctl enable --now libvirtd
603+
sudo apt-get build-dep -y vagrant ruby-libvirt
604+
sudo apt-get install -y --no-install-recommends libxslt-dev libxml2-dev libvirt-dev ruby-bundler ruby-dev zlib1g-dev
605+
sudo vagrant plugin install vagrant-libvirt vagrant-scp
606+
589607
- name: Vagrant start
590608
run: |
591-
# Retry if it fails (download.fedoraproject.org returns 404 sometimes)
592-
vagrant up || vagrant up
609+
sudo vagrant up --no-tty
593610
594611
# slow, so separated from the regular cgroup2 task
595612
- name: CRI-in-UserNS test with Rootless Podman
596613
run: |
597-
vagrant up --provision-with=install-rootless-podman
614+
sudo vagrant up --provision-with=install-rootless-podman
598615
# Execute rootless podman to create the UserNS env
599-
vagrant ssh -- podman build --target cri-in-userns -t cri-in-userns -f /vagrant/contrib/Dockerfile.test /vagrant
600-
vagrant ssh -- podman run --rm --privileged cri-in-userns
601-
602-
- name: Collect the VM's IP address for Docker Hub's throttling issue
603-
if: failure()
604-
run: vagrant ssh -- curl https://api64.ipify.org/
616+
sudo vagrant ssh -- podman build --target cri-in-userns -t cri-in-userns -f /vagrant/contrib/Dockerfile.test /vagrant
617+
sudo vagrant ssh -- podman run --rm --privileged cri-in-userns

Vagrantfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Vagrant.configure("2") do |config|
2828
config.vm.provider :libvirt do |v|
2929
v.memory = memory
3030
v.cpus = cpus
31+
v.loader = "/usr/share/OVMF/OVMF_CODE.fd"
3132
end
3233

3334
config.vm.synced_folder ".", "/vagrant", type: "rsync"

0 commit comments

Comments
 (0)