Skip to content

Commit 968e261

Browse files
committed
ci: install criu dependency
install criu in ci to test checkpoint. Signed-off-by: ChengyuZhu6 <[email protected]>
1 parent 8b26ec1 commit 968e261

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

.github/workflows/job-test-in-container.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,17 @@ jobs:
149149
sudo sysctl -w net.ipv4.ip_forward=1
150150
# Enable IPv6 for Docker, and configure docker to use containerd for gha
151151
sudo mkdir -p /etc/docker
152-
echo '{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64", "experimental": true, "ip6tables": true}' | sudo tee /etc/docker/daemon.json
152+
echo '{"ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64", "ip6tables": true}' | sudo tee /etc/docker/daemon.json
153+
- name: "Init: enable Docker experimental features"
154+
run: |
155+
sudo mkdir -p /etc/docker
156+
if [ -f /etc/docker/daemon.json ]; then
157+
tmpfile="$(mktemp)"
158+
sudo jq '.experimental = true' /etc/docker/daemon.json | sudo tee "$tmpfile" >/dev/null
159+
sudo mv "$tmpfile" /etc/docker/daemon.json
160+
else
161+
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json >/dev/null
162+
fi
153163
sudo systemctl restart docker
154164
- name: "Run: integration tests"
155165
run: |

.github/workflows/job-test-in-host.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ jobs:
107107
name: "Init (linux): prepare host"
108108
run: |
109109
if [ "${{ contains(inputs.binary, 'docker') }}" == true ]; then
110-
echo "::group:: configure cdi for docker"
110+
echo "::group:: configure cdi and experimentalfor docker"
111111
sudo mkdir -p /etc/docker
112-
sudo jq '.features.cdi = true' /etc/docker/daemon.json | sudo tee /etc/docker/daemon.json.tmp && sudo mv /etc/docker/daemon.json.tmp /etc/docker/daemon.json
112+
sudo jq -n '.features.cdi = true | .experimental = true' | sudo tee /etc/docker/daemon.json
113113
echo "::endgroup::"
114114
echo "::group:: downgrade docker to the specific version we want to test (${{ inputs.docker-version }})"
115115
sudo apt-get update -qq
@@ -122,6 +122,7 @@ jobs:
122122
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
123123
sudo apt-get update -qq
124124
sudo apt-get install -qq --allow-downgrades docker-ce=${{ inputs.docker-version }} docker-ce-cli=${{ inputs.docker-version }}
125+
sudo systemctl restart docker
125126
echo "::endgroup::"
126127
else
127128
# FIXME: this is missing runc (see top level workflow note about the state of this)
@@ -153,7 +154,8 @@ jobs:
153154
154155
# FIXME: remove expect when we are done removing unbuffer from tests
155156
echo "::group:: installing test dependencies"
156-
sudo apt-get install -qq expect
157+
sudo add-apt-repository ppa:criu/ppa -y
158+
sudo apt-get install -qq expect criu
157159
echo "::endgroup::"
158160
159161
# This ensures that bridged traffic goes through netfilter

.github/workflows/job-test-unit.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ jobs:
6868
go-version: ${{ env.GO_VERSION }}
6969
check-latest: true
7070

71-
# Install CNI
71+
# Install CNI and CRIU
7272
- if: ${{ env.GO_VERSION != '' }}
73-
name: "Init: set up CNI"
73+
name: "Init: set up CNI and CRIU"
7474
run: |
7575
if [ "$RUNNER_OS" == "Windows" ]; then
7676
GOPATH=$(go env GOPATH) WINCNI_VERSION=${{ inputs.windows-cni-version }} ./hack/provisioning/windows/cni.sh
7777
elif [ "$RUNNER_OS" == "Linux" ]; then
7878
./hack/provisioning/linux/cni.sh install "${{ inputs.linux-cni-version }}" "amd64" "${{ inputs.linux-cni-sha }}"
79+
sudo apt-get update -qq
80+
sudo add-apt-repository ppa:criu/ppa -y
81+
sudo apt-get install -qq criu
7982
fi
8083
8184
- if: ${{ env.GO_VERSION != '' }}

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ RUN perl -pi -e 's/multi-user.target/docker-entrypoint.target/g' /usr/local/lib/
294294
systemctl enable containerd buildkit stargz-snapshotter && \
295295
mkdir -p /etc/bash_completion.d && \
296296
nerdctl completion bash >/etc/bash_completion.d/nerdctl && \
297-
mkdir -p -m 0755 /etc/cni
297+
mkdir -p -m 0755 /etc/cni /etc/cdi /var/run/cdi /etc/buildkit/cdi
298298
COPY ./Dockerfile.d/etc_containerd_config.toml /etc/containerd/config.toml
299299
COPY ./Dockerfile.d/etc_buildkit_buildkitd.toml /etc/buildkit/buildkitd.toml
300300
VOLUME /var/lib/containerd
@@ -309,10 +309,17 @@ ARG DEBIAN_FRONTEND=noninteractive
309309
# `expect` package contains `unbuffer(1)`, which is used for emulating TTY for testing
310310
# `jq` is required to generate test summaries
311311
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
312-
expect \
313-
jq \
314-
git \
315-
make
312+
software-properties-common \
313+
gnupg \
314+
gpg-agent \
315+
ca-certificates && \
316+
add-apt-repository ppa:criu/ppa && \
317+
apt-get update -qq && apt-get install -qq --no-install-recommends \
318+
expect \
319+
jq \
320+
git \
321+
make \
322+
criu
316323
# We wouldn't need this if Docker Hub could have "golang:${GO_VERSION}-ubuntu"
317324
COPY --from=build-base /usr/local/go /usr/local/go
318325
ARG TARGETARCH

extras/rootless/containerd-rootless.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ else
161161
# so that we can create our own files in our mount namespace.
162162
# The actual files in the parent namespace are *not removed* by this rm command.
163163
rm -f /run/containerd /run/xtables.lock \
164-
/var/lib/containerd /var/lib/cni /etc/containerd
164+
/var/lib/containerd /var/lib/cni /etc/containerd /etc/cni/net.d /etc/cdi /var/run/cdi /etc/buildkit/cdi
165165

166166
# Bind-mount /etc/ssl.
167167
# Workaround for "x509: certificate signed by unknown authority" on openSUSE Tumbleweed.
@@ -187,6 +187,18 @@ else
187187
mkdir -p "${XDG_CONFIG_HOME}/containerd" "/etc/containerd"
188188
mount --bind "${XDG_CONFIG_HOME}/containerd" "/etc/containerd"
189189

190+
# Bind-mount /etc/cni/net.d
191+
mkdir -p "${XDG_CONFIG_HOME}/cni/net.d" "/etc/cni/net.d"
192+
mount --bind "${XDG_CONFIG_HOME}/cni/net.d" "/etc/cni/net.d"
193+
194+
# Bind-mount CDI directories
195+
mkdir -p "${XDG_CONFIG_HOME}/cdi" "/etc/cdi"
196+
mount --bind "${XDG_CONFIG_HOME}/cdi" "/etc/cdi"
197+
mkdir -p "${XDG_DATA_HOME}/cdi" "/var/run/cdi"
198+
mount --bind "${XDG_DATA_HOME}/cdi" "/var/run/cdi"
199+
mkdir -p "${XDG_CONFIG_HOME}/buildkit/cdi" "/etc/buildkit/cdi"
200+
mount --bind "${XDG_CONFIG_HOME}/buildkit/cdi" "/etc/buildkit/cdi"
201+
190202
if [ -n "$_CONTAINERD_ROOTLESS_SELINUX" ]; then
191203
# iptables requires /run in the child to be relabeled. The actual /run in the parent is unaffected.
192204
# https://github.com/containers/podman/blob/e6fc34b71aa9d876b1218efe90e14f8b912b0603/libpod/networking_linux.go#L396-L401

0 commit comments

Comments
 (0)