Merge pull request #2453 from AkihiroSuda/vagrant-centos7

CI: add CentOS 7 (kernel 3.10, systemd 219)
This commit is contained in:
Mrunal Patel 2020-06-15 21:09:43 -07:00 committed by GitHub
commit 82d2fa4eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 98 additions and 11 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

View File

@ -60,6 +60,10 @@ func testCheckpoint(t *testing.T, userns bool) {
return
}
if _, err := exec.LookPath("criu"); err != nil {
t.Skipf("criu binary not found: %v", err)
}
root, err := newTestRoot()
if err != nil {
t.Fatal(err)

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

View File

@ -79,7 +79,7 @@ function teardown() {
SPEC_REF=$([[ -z "$SPEC_COMMIT" ]] && echo $SPEC_VERSION || echo $SPEC_COMMIT)
run git -C src/runtime-spec reset --hard "${SPEC_REF}"
run bash -c "cd src/runtime-spec && git reset --hard ${SPEC_REF}"
[ "$status" -eq 0 ]
[ -e src/runtime-spec/schema/config-schema.json ]
@ -87,7 +87,7 @@ function teardown() {
run bash -c "GOPATH='$GOPATH' go get github.com/xeipuuv/gojsonschema"
[ "$status" -eq 0 ]
run git -C "${GOPATH}/src/github.com/xeipuuv/gojsonschema" reset --hard 6637feb73ee44cd4640bb3def285c29774234c7f
run bash -c "cd ${GOPATH}/src/github.com/xeipuuv/gojsonschema && git reset --hard 6637feb73ee44cd4640bb3def285c29774234c7f"
[ "$status" -eq 0 ]
GOPATH="$GOPATH" go build src/runtime-spec/schema/validate.go

View File

@ -67,6 +67,10 @@ function setup() {
;;
esac
SD_UNLIMITED="infinity"
SD_VERSION=$(systemctl --version | awk '{print $2; exit}')
if [ $SD_VERSION -lt 227 ]; then
SD_UNLIMITED="18446744073709551615"
fi
# check that initial values were properly set
check_cgroup_value "cpuset.cpus" 0

View File

@ -146,7 +146,7 @@ do
# https://bugzilla.redhat.com/show_bug.cgi?id=1788616
ssh -t -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $HOME/rootless.key rootless@localhost -- PATH="$PATH" RUNC_USE_SYSTEMD="$RUNC_USE_SYSTEMD" bats -t "$ROOT/tests/integration$ROOTLESS_TESTPATH"
else
sudo -HE -u rootless PATH="$PATH" bats -t "$ROOT/tests/integration$ROOTLESS_TESTPATH"
sudo -HE -u rootless PATH="$PATH" $(which bats) -t "$ROOT/tests/integration$ROOTLESS_TESTPATH"
fi
set +e
done