File tree Expand file tree Collapse file tree 5 files changed +31
-26
lines changed Expand file tree Collapse file tree 5 files changed +31
-26
lines changed Original file line number Diff line number Diff line change 31
31
install_dependencies_script : |
32
32
case $DISTRO in
33
33
*-8)
34
- yum config-manager --set-enabled powertools # for glibc-static
34
+ dnf config-manager --set-enabled powertools # for glibc-static
35
35
;;
36
36
*-9)
37
37
dnf config-manager --set-enabled crb # for glibc-static
50
50
done
51
51
[ $? -eq 0 ] # fail if yum failed
52
52
53
+ case $DISTRO in
54
+ *-8)
55
+ # Use newer criu (with https://github.com/checkpoint-restore/criu/pull/2545).
56
+ # Alas we have to disable container-tools for that.
57
+ dnf -y module disable container-tools
58
+ dnf -y copr enable adrian/criu-el8
59
+ dnf -y install criu
60
+ esac
61
+
53
62
# Install Go.
54
63
URL_PREFIX="https://go.dev/dl/"
55
64
# Find out the latest minor release URL.
62
71
git checkout $BATS_VERSION
63
72
./install.sh /usr/local
64
73
cd -
65
- # Add a user for rootless tests
66
- useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
67
- # Allow root and rootless itself to execute `ssh rootless@localhost` in tests/rootless.sh
68
- ssh-keygen -t ecdsa -N "" -f /root/rootless.key
69
- mkdir -m 0700 -p /home/rootless/.ssh
70
- cp /root/rootless.key /home/rootless/.ssh/id_ecdsa
71
- cat /root/rootless.key.pub >> /home/rootless/.ssh/authorized_keys
72
- chown -R rootless.rootless /home/rootless
74
+ # Setup rootless tests.
75
+ /home/runc/script/setup_rootless.sh
73
76
# set PATH
74
77
echo 'export PATH=/usr/local/go/bin:/usr/local/bin:$PATH' >> /root/.bashrc
75
78
# Setup ssh localhost for terminal emulation (script -e did not work)
Original file line number Diff line number Diff line change @@ -159,13 +159,7 @@ jobs:
159
159
- name : add rootless user
160
160
if : matrix.rootless == 'rootless'
161
161
run : |
162
- sudo useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
163
- # Allow root and rootless itself to execute `ssh rootless@localhost` in tests/rootless.sh
164
- ssh-keygen -t ecdsa -N "" -f $HOME/rootless.key
165
- sudo mkdir -m 0700 -p /home/rootless/.ssh
166
- sudo cp $HOME/rootless.key /home/rootless/.ssh/id_ecdsa
167
- sudo cp $HOME/rootless.key.pub /home/rootless/.ssh/authorized_keys
168
- sudo chown -R rootless.rootless /home/rootless
162
+ ./script/setup_rootless.sh
169
163
sudo chmod a+X $HOME # for Ubuntu 22.04 and later
170
164
171
165
- name : integration test (fs driver)
Original file line number Diff line number Diff line change @@ -12,15 +12,8 @@ dnf clean all
12
12
# To avoid "avc: denied { nosuid_transition }" from SELinux as we run tests on /tmp.
13
13
mount -o remount,suid /tmp
14
14
15
- # Add a user for rootless tests
16
- useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
17
-
18
- # Allow root and rootless itself to execute `ssh rootless@localhost` in tests/rootless.sh
19
- ssh-keygen -t ecdsa -N " " -f /root/rootless.key
20
- mkdir -m 0700 /home/rootless/.ssh
21
- cp /root/rootless.key /home/rootless/.ssh/id_ecdsa
22
- cat /root/rootless.key.pub >> /home/rootless/.ssh/authorized_keys
23
- chown -R rootless.rootless /home/rootless
15
+ # Setup rootless user.
16
+ " $( dirname " ${BASH_SOURCE[0]} " ) " /setup_rootless.sh
24
17
25
18
# Delegate cgroup v2 controllers to rootless user via --systemd-cgroup
26
19
mkdir -p /etc/systemd/system/
[email protected]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -eux -o pipefail
3
+
4
+ # Add a user for rootless tests.
5
+ sudo useradd -u2000 -m -d/home/rootless -s/bin/bash rootless
6
+
7
+ # Allow both the current user and rootless itself to use
8
+ # ssh rootless@localhost in tests/rootless.sh.
9
+ # shellcheck disable=SC2174 # Silence "-m only applies to the deepest directory".
10
+ mkdir -p -m 0700 " $HOME /.ssh"
11
+ ssh-keygen -t ecdsa -N " " -f " $HOME /.ssh/rootless.key"
12
+ sudo mkdir -p -m 0700 /home/rootless/.ssh
13
+ sudo cp " $HOME /.ssh/rootless.key" /home/rootless/.ssh/id_ecdsa
14
+ sudo cp " $HOME /.ssh/rootless.key.pub" /home/rootless/.ssh/authorized_keys
15
+ sudo chown -R rootless.rootless /home/rootless
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ for enabled_features in $features_powerset; do
185
185
# We use `ssh rootless@localhost` instead of `sudo -u rootless` for creating systemd user session.
186
186
# Alternatively we could use `machinectl shell`, but it is known not to work well on SELinux-enabled hosts as of April 2020:
187
187
# https://bugzilla.redhat.com/show_bug.cgi?id=1788616
188
- 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 "
188
+ ssh -t -t -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i " $HOME /.ssh/ rootless.key" rootless@localhost -- PATH=" $PATH " RUNC_USE_SYSTEMD=" $RUNC_USE_SYSTEMD " bats -t " $ROOT /tests/integration$ROOTLESS_TESTPATH "
189
189
else
190
190
sudo -HE -u rootless PATH=" $PATH " " $( which bats) " -t " $ROOT /tests/integration$ROOTLESS_TESTPATH "
191
191
fi
You can’t perform that action at this time.
0 commit comments