# -*- mode: ruby -*- # vi: set ft=ruby : # Copyright The containerd Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Vagrantfile for Fedora and EL Vagrant.configure("2") do |config| config.vm.box = ENV["BOX"] ? ENV["BOX"].split("@")[0] : "fedora/40-cloud-base" # BOX_VERSION is deprecated. Use "BOX=@". config.vm.box_version = ENV["BOX_VERSION"] || (ENV["BOX"].split("@")[1] if ENV["BOX"]) memory = 4096 cpus = 2 disk_size = 60 config.vm.provider :virtualbox do |v, o| v.memory = memory v.cpus = cpus # Needs env var VAGRANT_EXPERIMENTAL="disks" o.vm.disk :disk, size: "#{disk_size}GB", primary: true v.customize ["modifyvm", :id, "--firmware", "efi"] end config.vm.provider :libvirt do |v| v.memory = memory v.cpus = cpus v.machine_virtual_size = disk_size v.loader = "/usr/share/OVMF/OVMF_CODE.fd" end config.vm.synced_folder ".", "/vagrant", type: "rsync" config.vm.provision 'shell', path: 'script/resize-vagrant-root.sh' # Disabled by default. To run: # vagrant up --provision-with=upgrade-packages # To upgrade only specific packages: # UPGRADE_PACKAGES=selinux vagrant up --provision-with=upgrade-packages # config.vm.provision "upgrade-packages", type: "shell", run: "never" do |sh| sh.upload_path = "/tmp/vagrant-upgrade-packages" sh.env = { 'UPGRADE_PACKAGES': ENV['UPGRADE_PACKAGES'], } sh.inline = <<~SHELL #!/usr/bin/env bash set -eux -o pipefail dnf -y upgrade ${UPGRADE_PACKAGES} SHELL end # To re-run, installing CNI from RPM: # INSTALL_PACKAGES="containernetworking-plugins" vagrant up --provision-with=install-packages # config.vm.provision "install-packages", type: "shell", run: "once" do |sh| sh.upload_path = "/tmp/vagrant-install-packages" sh.env = { 'INSTALL_PACKAGES': ENV['INSTALL_PACKAGES'], } sh.inline = <<~SHELL #!/usr/bin/env bash set -eux -o pipefail dnf -y install \ container-selinux \ curl \ gcc \ git \ iptables \ libseccomp-devel \ libselinux-devel \ lsof \ make \ strace \ ${INSTALL_PACKAGES} SHELL end # EL does not have /usr/local/{bin,sbin} in the PATH by default config.vm.provision "setup-etc-environment", type: "shell", run: "once" do |sh| sh.upload_path = "/tmp/vagrant-setup-etc-environment" sh.inline = <<~SHELL #!/usr/bin/env bash set -eux -o pipefail cat >> /etc/environment <> /etc/profile.d/sh.local < /tmp/containerd.log cat /tmp/containerd.log systemctl stop containerd } selinux=$(getenforce) if [[ $selinux == Enforcing ]]; then setenforce 0 fi systemctl enable --now ${GOPATH}/src/github.com/containerd/containerd/containerd.service if [[ $selinux == Enforcing ]]; then setenforce 1 fi trap cleanup EXIT ctr version critest --parallel=$[$(nproc)+2] --ginkgo.skip='HostIpc is true' --report-dir="${REPORT_DIR}" SHELL end end