add Vagrantfile.centos7

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2020-06-03 14:16:10 +09:00
parent 262ef5631a
commit 499357d61a
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A
5 changed files with 87 additions and 8 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ vendor/pkg
contrib/cmd/recvtty/recvtty
man/man8
release
Vagrantfile
.vagrant

View File

@ -20,15 +20,10 @@ matrix:
script:
- make all
- sudo PATH="$PATH" make localintegration RUNC_USE_SYSTEMD=1
- go: 1.13.x
name: "cgroup-v2"
env:
- VAGRANT_VERSION=2.2.7
- name: "fedora32"
before_install:
- cat /proc/cpuinfo
# https://github.com/alvistack/ansible-role-virtualbox/blob/6887b020b0ca5c59ddb6620d73f053ffb84f4126/.travis.yml#L30
- sudo apt-get install -q -y bridge-utils dnsmasq-base ebtables libvirt-bin libvirt-dev qemu-kvm qemu-utils ruby-dev && wget https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_$(uname -m).deb && sudo dpkg -i vagrant_${VAGRANT_VERSION}_$(uname -m).deb && rm -f vagrant_${VAGRANT_VERSION}_$(uname -m).deb
- sudo vagrant plugin install vagrant-libvirt
- sudo ./script/install-vagrant.sh
- ln -sf Vagrantfile.fedora32 Vagrantfile
- sudo vagrant up && sudo mkdir -p /root/.ssh && sudo sh -c "vagrant ssh-config >> /root/.ssh/config"
script:
- sudo ssh default -t 'cd /vagrant && sudo make localunittest'
@ -40,6 +35,23 @@ matrix:
- sudo ssh default -t 'cd /vagrant && sudo make localrootlessintegration RUNC_USE_SYSTEMD=yes'
# same setup but with fs2 driver (rootless) instead of systemd
- sudo ssh default -t 'cd /vagrant && sudo make localrootlessintegration'
- name: "centos7"
before_install:
- sudo ./script/install-vagrant.sh
- ln -sf Vagrantfile.centos7 Vagrantfile
- sudo vagrant up && sudo mkdir -p /root/.ssh && sudo sh -c "vagrant ssh-config >> /root/.ssh/config"
script:
# kernel 3.10 (frankenized), systemd 219
- sudo ssh default 'rpm -q centos-release kernel systemd'
# FIXME: the following unit tests are skipped (TESTFLAGS=-short):
# FAIL: TestPidsSystemd: utils_test.go:55: exec_test.go:630: unexpected error: container_linux.go:353: starting container process caused: process_linux.go:326: applying cgroup configuration for process caused: mountpoint for devices not found
# FAIL: TestRunWithKernelMemorySystemd: exec_test.go:713: runContainer failed with kernel memory limit: container_linux.go:353: starting container process caused: process_linux.go:326: applying cgroup configuration for process caused: mkdir : no such file or directory
- sudo ssh default -t 'sudo -i make -C /vagrant localunittest TESTFLAGS=-short'
- sudo ssh default -t 'sudo -i make -C /vagrant localintegration'
- sudo ssh default -t 'sudo -i make -C /vagrant localintegration RUNC_USE_SYSTEMD=1'
# FIXME: rootless is skipped because of EPERM on writing cgroup.procs
# - sudo ssh default -t 'sudo -i make -C /vagrant localrootlessintegration'
allow_failures:
- go: tip

54
Vagrantfile.centos7 Normal file
View File

@ -0,0 +1,54 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.provider :virtualbox do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.provider :libvirt do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
# configuration
GO_VERSION="1.13.11"
BATS_VERSION="v1.2.0"
# install yum packages
yum install -y -q epel-release
yum install -y -q gcc git iptables jq libseccomp-devel make
yum clean all
# install Go
curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar Cxz /usr/local
# install bats
git clone https://github.com/bats-core/bats-core
cd bats-core
git checkout $BATS_VERSION
./install.sh /usr/local
# NOTE: criu is NOT installed. criu tests are skipped.
# set PATH (NOTE: sudo without -i ignores this PATH)
cat >> /etc/profile.d/sh.local <<EOF
PATH=/usr/local/go/bin:/usr/local/bin:$PATH
export PATH
EOF
source /etc/profile.d/sh.local
# sysctl
echo "user.max_user_namespaces=15076" > /etc/sysctl.d/userns.conf
sysctl --system
# Add a user for rootless tests
useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
# Add busybox for libcontainer/integration tests
. /vagrant/tests/integration/multi-arch.bash \
&& mkdir /busybox \
&& curl -fsSL $(get_busybox) | tar xfJC - /busybox
SHELL
end

11
script/install-vagrant.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -eux -o pipefail
VAGRANT_VERSION="2.2.7"
# https://github.com/alvistack/ansible-role-virtualbox/blob/6887b020b0ca5c59ddb6620d73f053ffb84f4126/.travis.yml#L30
apt-get update
apt-get install -q -y bridge-utils dnsmasq-base ebtables libvirt-bin libvirt-dev qemu-kvm qemu-utils ruby-dev
wget https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_$(uname -m).deb
dpkg -i vagrant_${VAGRANT_VERSION}_$(uname -m).deb
rm -f vagrant_${VAGRANT_VERSION}_$(uname -m).deb
vagrant plugin install vagrant-libvirt