Skip to content

Commit

Permalink
Adding a canary CI target to test against upcoming / unreleased versions
Browse files Browse the repository at this point in the history
Signed-off-by: apostasie <[email protected]>
  • Loading branch information
apostasie committed Jul 10, 2024
1 parent 77e6f18 commit d134674
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 7 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/test-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This pipeline purpose is solely meant to run a subset of our test suites against upcoming or unreleased dependencies versions
name: test-canary

on:
push:
branches:
- main
- 'release/**'
pull_request:
paths-ignore:
- '**.md'

env:
# If left blank, will default to latest stable
GO_VERSION: "1.23-rc1"
UBUNTU_VERSION: "24.04"

# Straight git branches
CONTAINERD_VERSION: "main"
IMGCRYPT_VERSION: "main"
BYPASS4NETNS_VERSION: "main"
KUBO_VERSION: "main"
GOTESTSUM_VERSION: "main"
# Set this to "next" for upcoming version (defined by `RegistryImageNext`)
DISTRIBUTION_VERSION: "next"
# FIXME. Currently pinned, see: https://github.com/containerd/nerdctl/pull/3153
RUNC_VERSION: "v1.1.13"

# Released versions - one can update these manually to override the Dockerfile pinned versions
BUILDKIT_VERSION: "v0.15.0-rc1"

#CNI_PLUGINS_VERSION: "v1.5.1"

Check warning on line 32 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

32:4 [comments] missing starting space in comment
#STARGZ_SNAPSHOTTER_VERSION: "v0.15.1"

Check warning on line 33 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

33:4 [comments] missing starting space in comment
#ROOTLESSKIT_VERSION: "v2.1.0"

Check warning on line 34 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

34:4 [comments] missing starting space in comment
#SLIRP4NETNS_VERSION: "v1.3.1"

Check warning on line 35 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

35:4 [comments] missing starting space in comment
#FUSE_OVERLAYFS_VERSION: "v1.13"

Check warning on line 36 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

36:4 [comments] missing starting space in comment
#CONTAINERD_FUSE_OVERLAYFS_VERSION: "v1.0.8"

Check warning on line 37 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

37:4 [comments] missing starting space in comment
#TINI_VERSION: "v0.19.0"

Check warning on line 38 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

38:4 [comments] missing starting space in comment
#BUILDG_VERSION: "v0.4.1"

Check warning on line 39 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

39:4 [comments] missing starting space in comment
#CONTAINERIZED_SYSTEMD_VERSION: "v0.1.1"

Check warning on line 40 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

40:4 [comments] missing starting space in comment
#NYDUS_VERSION: "v2.2.5"

Check warning on line 41 in .github/workflows/test-canary.yml

View workflow job for this annotation

GitHub Actions / lint

41:4 [comments] missing starting space in comment
#SOCI_SNAPSHOTTER_VERSION: "0.6.1"


jobs:
test-canary-linux:
runs-on: "ubuntu-24.04"
timeout-minutes: 40
steps:
- uses: actions/[email protected]
with:
fetch-depth: 1
- name: "Prepare integration test environment"
run: DOCKER_BUILDKIT=1 docker build -t test-integration --target test-integration --build-arg UBUNTU_VERSION=$UBUNTU_VERSION --build-arg CONTAINERD_VERSION=$CONTAINERD_VERSION .
- name: "Remove snap loopback devices (conflicts with our loopback devices in TestRunDevice)"
run: |
sudo systemctl disable --now snapd.service snapd.socket
sudo apt-get purge -y snapd
sudo losetup -Dv
sudo losetup -lv
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Run unit tests"
run: go test -v ./pkg/...
- name: "Run integration tests"
continue-on-error: true
run: docker run -t --rm --privileged test-integration

test-canary-windows:
runs-on: windows-latest
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/[email protected]
with:
fetch-depth: 1
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
check-latest: true
- run: go install ./cmd/nerdctl
- uses: actions/[email protected]
with:
repository: containerd/containerd
ref: ${{ env.CONTAINERD_VERSION }}
path: containerd
fetch-depth: 1
- name: "Set up CNI"
working-directory: containerd
run: GOPATH=$(go env GOPATH) script/setup/install-cni-windows
- name: "Set up containerd"
env:
ctrdVersion: ${{ env.CONTAINERD_VERSION }}
run: powershell hack/configure-windows-ci.ps1
- name: "Run unit tests"
run: go test -v ./pkg/...
- name: "Run integration tests"
run: go test -v ./cmd/...
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- ubuntu: 22.04
containerd: v1.7.19
- ubuntu: 24.04
containerd: main # v2.0.0-rc.X
containerd: v2.0.0-rc.3
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
rootlesskit: v2.1.0
target: test-integration-rootless
- ubuntu: 24.04
containerd: main # v2.0.0-rc.X
containerd: v2.0.0-rc.3
rootlesskit: v2.1.0
target: test-integration-rootless
- ubuntu: 24.04
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ARG SOCI_SNAPSHOTTER_VERSION=0.6.1
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.4.0 AS xx


FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bullseye AS build-base-debian
FROM --platform=$BUILDPLATFORM golang:$GO_VERSION${GO_VERSION:+-}bullseye AS build-base-debian
COPY --from=xx / /
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
Expand Down Expand Up @@ -110,7 +110,7 @@ RUN xx-go --wrap && \
make build && \
xx-verify --static cmd/ipfs/ipfs && cp -a cmd/ipfs/ipfs /out/${TARGETARCH}

FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS build-base
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}${GO_VERSION:+-}alpine AS build-base
RUN apk add --no-cache make git curl
COPY . /go/src/github.com/containerd/nerdctl
WORKDIR /go/src/github.com/containerd/nerdctl
Expand Down
12 changes: 10 additions & 2 deletions pkg/testutil/testregistry/testregistry_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ type TokenAuthServer struct {
}

func EnsureImages(base *testutil.Base) {
base.Cmd("pull", testutil.RegistryImage).AssertOK()
if os.Getenv("DISTRIBUTION_VERSION") == "next" {
base.Cmd("pull", testutil.RegistryImageNext).AssertOK()
} else {
base.Cmd("pull", testutil.RegistryImageStable).AssertOK()
}
base.Cmd("pull", testutil.DockerAuthImage).AssertOK()
base.Cmd("pull", testutil.KuboImage).AssertOK()
}
Expand Down Expand Up @@ -340,7 +344,11 @@ func NewRegistry(base *testutil.Base, ca *testca.CA, port int, auth Auth, boundC
}

args = append(args, auth.Params(base)...)
args = append(args, testutil.RegistryImage)
registryImage := testutil.RegistryImageStable
if os.Getenv("DISTRIBUTION_VERSION") == "next" {
registryImage = testutil.RegistryImageNext
}
args = append(args, registryImage)

cleanup := func(err error) {
result := base.Cmd("rm", "-f", containerName).Run()
Expand Down
3 changes: 2 additions & 1 deletion pkg/testutil/testutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ var (
AlpineImage = mirrorOf("alpine:3.13")
NginxAlpineImage = mirrorOf("nginx:1.19-alpine")
NginxAlpineIndexHTMLSnippet = "<title>Welcome to nginx!</title>"
RegistryImage = mirrorOf("registry:2")
RegistryImageStable = mirrorOf("registry:2")
RegistryImageNext = "ghcr.io/distribution/distribution:3.0.0-beta.1"
WordpressImage = mirrorOf("wordpress:5.7")
WordpressIndexHTMLSnippet = "<title>WordPress &rsaquo; Installation</title>"
MariaDBImage = mirrorOf("mariadb:10.5")
Expand Down

0 comments on commit d134674

Please sign in to comment.