Skip to content

Commit 4071c3c

Browse files
authored
Merge pull request opencontainers#3104 from adrianreber/2021-07-20-vagrant
Do not use Vagrant for CentOS 7/8
2 parents 713748d + 9f656db commit 4071c3c

File tree

4 files changed

+115
-68
lines changed

4 files changed

+115
-68
lines changed

.cirrus.yml

Lines changed: 104 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
---
2-
# We use Cirrus for Vagrant tests, because macOS instances of GHA
3-
# are too slow and flaky, and Linux instances of GHA do not support KVM.
2+
# We use Cirrus for Vagrant tests and native CentOS 7 and 8, because macOS
3+
# instances of GHA are too slow and flaky, and Linux instances of GHA do not
4+
# support KVM.
45

56
# NOTE Cirrus execution environments lack a terminal, needed for
67
# some integration tests. So we use `ssh -tt` command to fake a terminal.
78

8-
compute_engine_instance:
9-
image_project: cirrus-images
10-
image: family/docker-kvm
11-
platform: linux
12-
nested_virtualization: true
13-
# CPU limit: `16 / NTASK`: see https://cirrus-ci.org/faq/#are-there-any-limits
14-
cpu: 8
15-
# Memory limit: `4GB * NCPU`
16-
memory: 32G
17-
18-
vagrant_task:
9+
task:
1910
timeout_in: 30m
11+
2012
env:
2113
DEBIAN_FRONTEND: noninteractive
2214
HOME: /root
2315
# yamllint disable rule:key-duplicates
2416
matrix:
2517
DISTRO: fedora34
26-
DISTRO: centos7
18+
19+
name: vagrant DISTRO:$DISTRO
20+
21+
compute_engine_instance:
22+
image_project: cirrus-images
23+
image: family/docker-kvm
24+
platform: linux
25+
nested_virtualization: true
26+
# CPU limit: `16 / NTASK`: see https://cirrus-ci.org/faq/#are-there-any-limits
27+
cpu: 8
28+
# Memory limit: `4GB * NCPU`
29+
memory: 32G
30+
2731
host_info_script: |
2832
uname -a
2933
echo "-----"
@@ -65,3 +69,89 @@ vagrant_task:
6569
else
6670
ssh -tt default "sudo -i make -C /vagrant localrootlessintegration"
6771
fi
72+
73+
task:
74+
timeout_in: 30m
75+
76+
env:
77+
HOME: /root
78+
CIRRUS_WORKING_DIR: /home/runc
79+
GO_VERSION: "1.16.6"
80+
BATS_VERSION: "v1.3.0"
81+
# yamllint disable rule:key-duplicates
82+
matrix:
83+
DISTRO: centos-7
84+
DISTRO: centos-stream-8
85+
86+
name: ci / $DISTRO
87+
88+
compute_engine_instance:
89+
image_project: centos-cloud
90+
image: family/$DISTRO
91+
platform: linux
92+
cpu: 4
93+
memory: 8G
94+
95+
install_dependencies_script: |
96+
yum install -y -q epel-release
97+
case $DISTRO in
98+
centos-7)
99+
(cd /etc/yum.repos.d && curl -O https://copr.fedorainfracloud.org/coprs/adrian/criu-el7/repo/epel-7/adrian-criu-el7-epel-7.repo)
100+
# sysctl
101+
echo "user.max_user_namespaces=15076" > /etc/sysctl.d/userns.conf
102+
sysctl --system
103+
;;
104+
centos-stream-8)
105+
yum install -y -q dnf-plugins-core
106+
yum config-manager --set-enabled powertools
107+
;;
108+
esac
109+
yum install -y -q gcc git iptables jq glibc-static libseccomp-devel make criu
110+
# install Go
111+
curl -fsSL "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz" | tar Cxz /usr/local
112+
# install bats
113+
cd /tmp
114+
git clone https://github.com/bats-core/bats-core
115+
cd bats-core
116+
git checkout $BATS_VERSION
117+
./install.sh /usr/local
118+
cd -
119+
# Add a user for rootless tests
120+
useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
121+
# set PATH
122+
echo 'export PATH=/usr/local/go/bin:/usr/local/bin:$PATH' >> /root/.bashrc
123+
# Setup ssh localhost for terminal emulation (script -e did not work)
124+
ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519 -N ""
125+
cat /root/.ssh/id_ed25519.pub >> /root/.ssh/authorized_keys
126+
chmod 400 /root/.ssh/authorized_keys
127+
ssh-keyscan localhost >> /root/.ssh/known_hosts
128+
echo -e "Host localhost\n\tStrictHostKeyChecking no\t\nIdentityFile /root/.ssh/id_ed25519\n" >> /root/.ssh/config
129+
sed -e "s,PermitRootLogin.*,PermitRootLogin prohibit-password,g" -i /etc/ssh/sshd_config
130+
systemctl restart sshd
131+
host_info_script: |
132+
uname -a
133+
echo "-----"
134+
cat /etc/os-release
135+
echo "-----"
136+
cat /proc/cpuinfo
137+
echo "-----"
138+
df -T
139+
echo "-----"
140+
systemctl --version
141+
unit_tests_script: |
142+
ssh -tt localhost "make -C /home/runc localunittest"
143+
integration_systemd_script: |
144+
ssh -tt localhost "make -C /home/runc localintegration RUNC_USE_SYSTEMD=yes"
145+
integration_fs_script: |
146+
ssh -tt localhost "make -C /home/runc localintegration"
147+
integration_systemd_rootless_script: |
148+
echo "SKIP: integration_systemd_rootless_script requires cgroup v2"
149+
integration_fs_rootless_script: |
150+
case $DISTRO in
151+
centos-7)
152+
echo "SKIP: FIXME: integration_fs_rootless_script is skipped because of EPERM on writing cgroup.procs"
153+
;;
154+
centos-stream-8)
155+
ssh -tt localhost "make -C /home/runc localrootlessintegration"
156+
;;
157+
esac

Vagrantfile.centos7

Lines changed: 0 additions & 52 deletions
This file was deleted.

tests/integration/update.bats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ EOF
537537
root_period=$(cat "${CGROUP_CPU_BASE_PATH}/cpu.rt_period_us")
538538
root_runtime=$(cat "${CGROUP_CPU_BASE_PATH}/cpu.rt_runtime_us")
539539
# the following IFS magic sets dirs=("runc-cgroups-integration-test" "test-cgroup")
540-
IFS='/' read -r -a dirs <<<"$REL_CGROUPS_PATH"
540+
IFS='/' read -r -a dirs <<<"${REL_CGROUPS_PATH#/}"
541541
for ((i = 0; i < ${#dirs[@]}; i++)); do
542542
local target="$CGROUP_CPU_BASE_PATH"
543543
for ((j = 0; j <= i; j++)); do

tests/rootless.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22
# Copyright (C) 2017 SUSE LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -114,6 +114,15 @@ function enable_cgroup() {
114114
# necessary, and might actually be a bug in our impl of cgroup
115115
# handling.
116116
[[ "$cg" == "cpuset" ]] && chown rootless:rootless "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpuset."{cpus,mems}
117+
# The following is required by "update rt period and runtime".
118+
if [[ "$cg" == "cpu" ]]; then
119+
if [[ -e "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_period_us" ]]; then
120+
chown rootless:rootless "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_period_us"
121+
fi
122+
if [[ -e "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_runtime_us" ]]; then
123+
chown rootless:rootless "$CGROUP_MOUNT/$cg$CGROUP_PATH/cpu.rt_runtime_us"
124+
fi
125+
fi
117126
done
118127
# cgroup v2
119128
if [[ -e "$CGROUP_MOUNT/cgroup.controllers" ]]; then

0 commit comments

Comments
 (0)