...

Text file src/github.com/opencontainers/runc/Vagrantfile.fedora

Documentation: github.com/opencontainers/runc

     1# -*- mode: ruby -*-
     2# vi: set ft=ruby :
     3
     4Vagrant.configure("2") do |config|
     5# Fedora box is used for testing cgroup v2 support
     6  config.vm.box = "fedora/38-cloud-base"
     7  config.vm.provider :virtualbox do |v|
     8    v.memory = 2048
     9    v.cpus = 2
    10  end
    11  config.vm.provider :libvirt do |v|
    12    v.memory = 2048
    13    v.cpus = 2
    14  end
    15  config.vm.provision "shell", inline: <<-SHELL
    16    set -e -u -o pipefail
    17    # Work around dnf mirror failures by retrying a few times
    18    for i in $(seq 0 2); do
    19      sleep $i
    20      # "config exclude" dnf shell command is not working in Fedora 35
    21      # (see https://bugzilla.redhat.com/show_bug.cgi?id=2022571);
    22      # the workaround is to specify it as an option.
    23      cat << EOF | dnf -y --exclude=kernel,kernel-core shell && break
    24config install_weak_deps false
    25update
    26install iptables gcc make golang-go glibc-static libseccomp-devel bats jq git-core criu fuse-sshfs
    27ts run
    28EOF
    29    done
    30    dnf clean all
    31
    32    # Prevent the "fatal: unsafe repository" git complain during build.
    33    git config --global --add safe.directory /vagrant
    34
    35    # Add a user for rootless tests
    36    useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
    37
    38    # Allow root and rootless itself to execute `ssh rootless@localhost` in tests/rootless.sh
    39    ssh-keygen -t ecdsa -N "" -f /root/rootless.key
    40    mkdir -m 0700 -p /home/rootless/.ssh
    41    cp /root/rootless.key /home/rootless/.ssh/id_ecdsa
    42    cat /root/rootless.key.pub >> /home/rootless/.ssh/authorized_keys
    43    chown -R rootless.rootless /home/rootless
    44
    45    # Delegate cgroup v2 controllers to rootless user via --systemd-cgroup
    46    mkdir -p /etc/systemd/system/user@.service.d
    47    cat > /etc/systemd/system/user@.service.d/delegate.conf << EOF
    48[Service]
    49# default: Delegate=pids memory
    50# NOTE: delegation of cpuset requires systemd >= 244 (Fedora >= 32, Ubuntu >= 20.04).
    51Delegate=yes
    52EOF
    53    systemctl daemon-reload
    54  SHELL
    55end

View as plain text