Skip to content

Commit eeae96b

Browse files
authored
Merge pull request #4728 from kolyshkin/ci-criu
ci fixes (ssh-keygen and criu version bump for almalinux 8)
2 parents e55fe63 + 87ae2f8 commit eeae96b

File tree

5 files changed

+31
-26
lines changed

5 files changed

+31
-26
lines changed

.cirrus.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ task:
3131
install_dependencies_script: |
3232
case $DISTRO in
3333
*-8)
34-
yum config-manager --set-enabled powertools # for glibc-static
34+
dnf config-manager --set-enabled powertools # for glibc-static
3535
;;
3636
*-9)
3737
dnf config-manager --set-enabled crb # for glibc-static
@@ -50,6 +50,15 @@ task:
5050
done
5151
[ $? -eq 0 ] # fail if yum failed
5252
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+
5362
# Install Go.
5463
URL_PREFIX="https://go.dev/dl/"
5564
# Find out the latest minor release URL.
@@ -62,14 +71,8 @@ task:
6271
git checkout $BATS_VERSION
6372
./install.sh /usr/local
6473
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
7376
# set PATH
7477
echo 'export PATH=/usr/local/go/bin:/usr/local/bin:$PATH' >> /root/.bashrc
7578
# Setup ssh localhost for terminal emulation (script -e did not work)

.github/workflows/test.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,7 @@ jobs:
159159
- name: add rootless user
160160
if: matrix.rootless == 'rootless'
161161
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
169163
sudo chmod a+X $HOME # for Ubuntu 22.04 and later
170164
171165
- name: integration test (fs driver)

script/setup_host_fedora.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,8 @@ dnf clean all
1212
# To avoid "avc: denied { nosuid_transition }" from SELinux as we run tests on /tmp.
1313
mount -o remount,suid /tmp
1414

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
2417

2518
# Delegate cgroup v2 controllers to rootless user via --systemd-cgroup
2619
mkdir -p /etc/systemd/system/[email protected]

script/setup_rootless.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

tests/rootless.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ for enabled_features in $features_powerset; do
185185
# We use `ssh rootless@localhost` instead of `sudo -u rootless` for creating systemd user session.
186186
# Alternatively we could use `machinectl shell`, but it is known not to work well on SELinux-enabled hosts as of April 2020:
187187
# 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"
189189
else
190190
sudo -HE -u rootless PATH="$PATH" "$(which bats)" -t "$ROOT/tests/integration$ROOTLESS_TESTPATH"
191191
fi

0 commit comments

Comments
 (0)