Skip to content

Commit

Permalink
CI: add nerdctl
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Apr 10, 2024
1 parent a7a8b24 commit 59fd609
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
engine: [docker, podman]
engine: [docker, nerdctl, podman]
env:
CONTAINER_ENGINE: "${{ matrix.engine }}"
steps:
Expand All @@ -37,6 +37,13 @@ jobs:
sudo rm -rf /var/run/docker*
dockerd-rootless-setuptool.sh install
docker info
- name: Set up Rootless nerdctl
if: ${{ matrix.engine == 'nerdctl' }}
run: |
set -eux -o pipefail
sudo ./init-host/init-host.root.d/install-nerdctl.sh
./init-host/init-host.rootless.sh
nerdctl info
- name: Set up Rootless Podman
if: ${{ matrix.engine == 'podman' }}
run: |
Expand Down Expand Up @@ -69,6 +76,8 @@ jobs:
include:
- lxc-image: ubuntu:22.04
engine: docker
- lxc-image: ubuntu:22.04
engine: nerdctl
- lxc-image: images:fedora/39/cloud
engine: podman
env:
Expand Down
34 changes: 34 additions & 0 deletions init-host/init-host.root.d/install-nerdctl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -eux -o pipefail
if [ "$(id -u)" != "0" ]; then
echo "Must run as the root"
exit 1
fi

VERSION="2.0.0-beta.4"
SHASHA="dfc9b122fea81a661f33a4013662b5def8a98fce84c257b8ad60e4279d11183e"

arch=""
case "$(uname -m)" in
"x86_64")
arch="amd64"
;;
"aarch64")
arch="arm64"
;;
*)
echo >&2 "Unsupported architecture"
exit 1
;;
esac

mkdir -p /root/nerdctl.tmp
(
cd /root/nerdctl.tmp
curl -fSLO https://github.com/containerd/nerdctl/releases/download/v${VERSION}/nerdctl-full-${VERSION}-linux-${arch}.tar.gz
curl -fSLO https://github.com/containerd/nerdctl/releases/download/v${VERSION}/SHA256SUMS
[ "$(sha256sum SHA256SUMS | awk '{print $1}')" = "${SHASHA}" ]
sha256sum --check --ignore-missing SHA256SUMS
tar Cxzvvf /usr/local nerdctl-full-${VERSION}-linux-${arch}.tar.gz
)
rm -rf /root/nerdctl.tmp
6 changes: 3 additions & 3 deletions init-host/init-host.root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ case "${CONTAINER_ENGINE}" in
fi
systemctl disable --now docker
;;
"podman")
if ! command -v podman >/dev/null 2>&1; then
"${script_dir}"/init-host.root.d/install-podman.sh
"podman" | "nerdctl")
if ! command -v "${CONTAINER_ENGINE}" >/dev/null 2>&1; then
"${script_dir}"/init-host.root.d/install-"${CONTAINER_ENGINE}".sh
fi
;;
*)
Expand Down
5 changes: 5 additions & 0 deletions init-host/init-host.rootless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ case "${CONTAINER_ENGINE}" in
"docker")
dockerd-rootless-setuptool.sh install
;;
"nerdctl")
containerd-rootless-setuptool.sh install
containerd-rootless-setuptool.sh install-buildkit-containerd
containerd-rootless-setuptool.sh install-bypass4netnsd
;;
"podman")
systemctl --user enable --now podman-restart
;;
Expand Down

0 comments on commit 59fd609

Please sign in to comment.