Skip to content

Commit

Permalink
Merge branch 'containerd:main' into master
Browse files Browse the repository at this point in the history
Signed-off-by: YuRuosheng <[email protected]>
  • Loading branch information
Retrospection committed Feb 21, 2023
2 parents b0e20fd + ab86e85 commit c878de2
Show file tree
Hide file tree
Showing 68 changed files with 1,317 additions and 1,021 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ windows_task:
matrix:
- name: "Windows/containerd-1.6"
env:
ctrdVersion: 1.6.12
ctrdVersion: 1.6.16
env:
CGO_ENABLED: 0
build_script:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ghcr-image-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3.3.0
uses: docker/build-push-action@v4.0.0
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
76 changes: 50 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ on:
- 'release/**'
pull_request:

env:
GO_VERSION: 1.19.x

jobs:
project:
name: Project Checks
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: actions/[email protected]
with:
path: src/github.com/containerd/nerdctl
fetch-depth: 100
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: containerd/[email protected]
with:
working-directory: src/github.com/containerd/nerdctl
Expand All @@ -38,7 +41,9 @@ jobs:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/[email protected]
with:
Expand All @@ -51,12 +56,14 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: "Run unit tests"
run: go test -v ./pkg/...

Expand All @@ -69,11 +76,11 @@ jobs:
# ubuntu-20.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 20.04
containerd: v1.5.13
containerd: v1.5.17
- ubuntu: 20.04
containerd: v1.6.12
containerd: v1.6.16
- ubuntu: 22.04
containerd: v1.6.12
containerd: v1.6.16
- ubuntu: 22.04
containerd: main
env:
Expand Down Expand Up @@ -105,54 +112,71 @@ jobs:
# ubuntu-22.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 20.04
containerd: v1.5.13
containerd: v1.5.17
target: test-integration-rootless
- ubuntu: 20.04
containerd: v1.6.16
target: test-integration-rootless
- ubuntu: 22.04
containerd: v1.6.16
target: test-integration-rootless
- ubuntu: 22.04
containerd: main
target: test-integration-rootless
- ubuntu: 20.04
containerd: v1.5.17
target: test-integration-rootless-port-slirp4netns
- ubuntu: 20.04
containerd: v1.6.12
containerd: v1.6.16
target: test-integration-rootless-port-slirp4netns
- ubuntu: 22.04
containerd: v1.6.12
containerd: v1.6.16
target: test-integration-rootless-port-slirp4netns
- ubuntu: 22.04
containerd: main
target: test-integration-rootless-port-slirp4netns
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
TEST_TARGET: "${{ matrix.target }}"
steps:
- uses: actions/[email protected]
with:
fetch-depth: 1
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Prepare (network driver=slirp4netns, port driver=builtin)"
run: DOCKER_BUILDKIT=1 docker build -t test-integration-rootless --target test-integration-rootless --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
- name: "Test (network driver=slirp4netns, port driver=builtin)"
run: docker run -t --rm --privileged test-integration-rootless
- name: "Prepare (network driver=slirp4netns, port driver=slirp4netns)"
run: DOCKER_BUILDKIT=1 docker build -t test-integration-rootless-port-slirp4netns --target test-integration-rootless-port-slirp4netns --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
- name: "Test (network driver=slirp4netns, port driver=slirp4netns)"
run: docker run -t --rm --privileged test-integration-rootless-port-slirp4netns
run: DOCKER_BUILDKIT=1 docker build -t ${TEST_TARGET} --target ${TEST_TARGET} --build-arg UBUNTU_VERSION=${UBUNTU_VERSION} --build-arg CONTAINERD_VERSION=${CONTAINERD_VERSION} .
- name: "Test (network driver=slirp4netns, port driver=builtin)"
run: docker run -t --rm --privileged ${TEST_TARGET}

cross:
runs-on: ubuntu-22.04
timeout-minutes: 40
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
check-latest: true
- name: "Cross"
run: make artifacts

test-integration-docker-compatibility:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
check-latest: true
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Prepare integration test environment"
Expand Down
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
# TODO: verify commit hash

# Basic deps
ARG CONTAINERD_VERSION=v1.6.12
ARG CONTAINERD_VERSION=v1.6.16
ARG RUNC_VERSION=v1.1.4
ARG CNI_PLUGINS_VERSION=v1.1.1
ARG CNI_PLUGINS_VERSION=v1.2.0

# Extra deps: Build
ARG BUILDKIT_VERSION=v0.11.0
ARG BUILDKIT_VERSION=v0.11.2
# Extra deps: Lazy-pulling
ARG STARGZ_SNAPSHOTTER_VERSION=v0.14.1
# Extra deps: Nydus Lazy-pulling
ARG NYDUS_VERSION=v2.1.1
ARG NYDUS_VERSION=v2.1.3
# Extra deps: Encryption
ARG IMGCRYPT_VERSION=v1.1.7
# Extra deps: Rootless
Expand All @@ -39,7 +39,7 @@ ARG BYPASS4NETNS_VERSION=v0.3.0
ARG FUSE_OVERLAYFS_VERSION=v1.10
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION=v1.0.5
# Extra deps: IPFS
ARG KUBO_VERSION=v0.17.0
ARG KUBO_VERSION=v0.18.0
# Extra deps: Init
ARG TINI_VERSION=v0.19.0
# Extra deps: Debug
Expand All @@ -49,7 +49,7 @@ ARG BUILDG_VERSION=v0.4.1
ARG GO_VERSION=1.19
ARG UBUNTU_VERSION=22.04
ARG CONTAINERIZED_SYSTEMD_VERSION=v0.1.1
ARG GOTESTSUM_VERSION=v1.8.2
ARG GOTESTSUM_VERSION=v1.9.0

FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-debian
# libbtrfs: for containerd
Expand Down Expand Up @@ -248,7 +248,8 @@ COPY --from=out-full / /usr/local/
RUN perl -pi -e 's/multi-user.target/docker-entrypoint.target/g' /usr/local/lib/systemd/system/*.service && \
systemctl enable containerd buildkit stargz-snapshotter && \
mkdir -p /etc/bash_completion.d && \
nerdctl completion bash >/etc/bash_completion.d/nerdctl
nerdctl completion bash >/etc/bash_completion.d/nerdctl && \
mkdir -p -m 0755 /etc/cni
COPY ./Dockerfile.d/etc_containerd_config.toml /etc/containerd/config.toml
COPY ./Dockerfile.d/etc_buildkit_buildkitd.toml /etc/buildkit/buildkitd.toml
VOLUME /var/lib/containerd
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile.d/SHA256SUMS.d/buildkit-v0.11.0

This file was deleted.

2 changes: 2 additions & 0 deletions Dockerfile.d/SHA256SUMS.d/buildkit-v0.11.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
6d0fe3f1ec2dce4ed2a5c9baf05fb279225b3b0e3bbee4092304fe284ca7fc47 buildkit-v0.11.2.linux-amd64.tar.gz
8a8c2274852ea4bac6ccf1862a46679e93c013de8c5c0434a3040bab2e0a42a7 buildkit-v0.11.2.linux-arm64.tar.gz
2 changes: 0 additions & 2 deletions Dockerfile.d/SHA256SUMS.d/cni-plugins-v1.1.1

This file was deleted.

2 changes: 2 additions & 0 deletions Dockerfile.d/SHA256SUMS.d/cni-plugins-v1.2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
f3a841324845ca6bf0d4091b4fc7f97e18a623172158b72fc3fdcdb9d42d2d37 cni-plugins-linux-amd64-v1.2.0.tgz
525e2b62ba92a1b6f3dc9612449a84aa61652e680f7ebf4eff579795fe464b57 cni-plugins-linux-arm64-v1.2.0.tgz
3 changes: 0 additions & 3 deletions Dockerfile.d/SHA256SUMS.d/kubo-v0.17.0

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile.d/SHA256SUMS.d/kubo-v0.18.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# From https://github.com/ipfs/kubo/releases
feda3df53d1f9a80afb71518714894d54269fdd2f27eae675a048aa1e7c5b956 kubo_v0.18.0_linux-amd64.tar.gz
416974e3e12d019b72adbe2cc3f13398f281bdd53250d670497c606b423e68fc kubo_v0.18.0_linux-arm64.tar.gz
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ To load an image archive (`docker save` format or OCI format) into local Kuberne
# nerdctl --namespace k8s.io load < /path/to/image.tar
```

To read logs (experimental):
```console
# nerdctl --namespace=k8s.io ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
...
e8793b8cca8b registry.k8s.io/coredns/coredns:v1.9.3 "/coredns -conf /etc…" 2 minutes ago Up k8s://kube-system/coredns-787d4945fb-mfx6b/coredns
...

# nerdctl --namespace=k8s.io logs -f e8793b8cca8b
[INFO] plugin/reload: Running configuration SHA512 = 591cf328cccc12bc490481273e738df59329c62c0b729d94e8b61db9961c2fa5f046dd37f1cf888b953814040d180f52594972691cd6ff41be96639138a43908
CoreDNS-1.9.3
linux/amd64, go1.18.2, 45b0a11
...
```

### Rootless mode

To launch rootless containerd:
Expand Down
9 changes: 4 additions & 5 deletions cmd/nerdctl/compose_down_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import (
func TestComposeDownRemoveUsedNetwork(t *testing.T) {
base := testutil.NewBase(t)

if testutil.GetTarget() == testutil.Docker {
t.Skip("test skipped for docker")
}

var (
dockerComposeYAMLOrphan = fmt.Sprintf(`
version: '3.1'
Expand All @@ -53,13 +57,8 @@ services:
projectName := fmt.Sprintf("nerdctl-compose-test-%d", time.Now().Unix())
t.Logf("projectName=%q", projectName)

// orphanContainer := fmt.Sprintf("%s_orphan_1", projectName)

base.ComposeCmd("-p", projectName, "-f", compFull.YAMLFullPath(), "up", "-d").AssertOK()
// defer base.ComposeCmd("-p", projectName, "-f", compFull.YAMLFullPath(), "down", "-v").Run()

base.ComposeCmd("-p", projectName, "-f", compOrphan.YAMLFullPath(), "down", "-v").AssertCombinedOutContains("is in use")
// base.ComposeCmd("-p", projectName, "-f", compFull.YAMLFullPath(), "ps").AssertOutNotContains(orphanContainer)
}

func TestComposeDownRemoveOrphans(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nerdctl/compose_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func printComposeImages(ctx context.Context, cmd *cobra.Command, containers []co
return err
}

size, err := unpackedImageSize(ctx, sn, image)
size, err := imgutil.UnpackedImageSize(ctx, sn, image)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit c878de2

Please sign in to comment.