Skip to content

Merge branch 'containerd:main' into main #1

Merge branch 'containerd:main' into main

Merge branch 'containerd:main' into main #1

Workflow file for this run

name: test
on:
push:
branches:
- main
- 'release/**'
pull_request:
env:
GO_VERSION: 1.20.x
jobs:
project:
name: Project Checks
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v3.5.3
with:
path: src/github.com/containerd/nerdctl
fetch-depth: 100
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: src/github.com/containerd/nerdctl
- uses: containerd/project-checks@v1.1.0
with:
working-directory: src/github.com/containerd/nerdctl
repo-access-token: ${{ secrets.GITHUB_TOKEN }}
- run: ./hack/verify-no-patent.sh
working-directory: src/github.com/containerd/nerdctl
- run: ./hack/verify-pkg-isolation.sh
working-directory: src/github.com/containerd/nerdctl
lint:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.6.0
with:
version: v1.53.3
args: --verbose
- name: yamllint-lint
run: yamllint .
test-unit:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: true
- name: "Run unit tests"
run: go test -v ./pkg/...
test-integration:
runs-on: "ubuntu-${{ matrix.ubuntu }}"
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
# ubuntu-20.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 20.04
containerd: v1.6.22
- ubuntu: 20.04
containerd: v1.7.3
- ubuntu: 22.04
containerd: v1.7.3
- ubuntu: 22.04
containerd: main
env:
UBUNTU_VERSION: "${{ matrix.ubuntu }}"
CONTAINERD_VERSION: "${{ matrix.containerd }}"
steps:
- uses: actions/checkout@v3.5.3
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 integration tests"
run: docker run -t --rm --privileged test-integration
test-integration-rootless:
runs-on: "ubuntu-${{ matrix.ubuntu }}"
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# ubuntu-22.04: cgroup v1, ubuntu-22.04: cgroup v2
include:
- ubuntu: 20.04
containerd: v1.6.22
target: test-integration-rootless
- ubuntu: 20.04
containerd: v1.7.3
target: test-integration-rootless
- ubuntu: 22.04
containerd: v1.7.3
target: test-integration-rootless
- ubuntu: 22.04
containerd: main
target: test-integration-rootless
- ubuntu: 20.04
containerd: v1.6.22
target: test-integration-rootless-port-slirp4netns
- ubuntu: 20.04
containerd: v1.7.3
target: test-integration-rootless-port-slirp4netns
- ubuntu: 22.04
containerd: v1.7.3
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/checkout@v3.5.3
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_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 -e WORKAROUND_ISSUE_622=1 ${TEST_TARGET}
cross:
runs-on: ubuntu-22.04
timeout-minutes: 40
strategy:
matrix:
go-version: ["1.19.x", "1.20.x"]
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
check-latest: true
- name: "Cross"
run: GO_VERSION="$(echo ${{ matrix.go-version }} | sed -e s/.x//)" make artifacts
test-integration-docker-compatibility:
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
check-latest: true
# Docker >= 23 is still unsupported: https://github.com/containerd/nerdctl/issues/2421
- name: "Install Docker 20.10"
run: |
set -eux -o pipefail
# Uninstall the preinstalled Docker (Moby)
sudo apt-get remove moby-*
# Enable BuildKit explicitly
sudo apt-get install -y moreutils
cat /etc/docker/daemon.json
jq '.features.buildkit = true' </etc/docker/daemon.json | sudo sponge /etc/docker/daemon.json
cat /etc/docker/daemon.json
# Download Docker packages
curl -OSL https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/containerd.io_1.6.22-1_amd64.deb
curl -OSL https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-ce_20.10.24~3-0~ubuntu-jammy_amd64.deb
curl -OSL https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-ce-cli_20.10.24~3-0~ubuntu-jammy_amd64.deb
curl -OSL https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-buildx-plugin_0.11.2-1~ubuntu.22.04~jammy_amd64.deb
curl -OSL https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/docker-compose-plugin_2.20.2-1~ubuntu.22.04~jammy_amd64.deb
# Install Docker
sudo apt-get install -y ./*.deb
rm -f ./*.deb
# Print docker info
docker info
docker version
- name: "Register QEMU (tonistiigi/binfmt)"
run: docker run --privileged --rm tonistiigi/binfmt --install all
- name: "Prepare integration test environment"
run: |
sudo apt-get install -y expect
- name: "Ensure that the integration test suite is compatible with Docker"
run: go test -timeout 20m -v -exec sudo ./cmd/nerdctl/... -args -test.target=docker -test.kill-daemon
test-integration-windows:
# A "larger" runner is used for enabling Hyper-V containers
runs-on: windows-2022-8-cores
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3.5.3
with:
fetch-depth: 1
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true
check-latest: true
- run: go install ./cmd/nerdctl
- uses: actions/checkout@v3.5.3
with:
repository: containerd/containerd
ref: v1.7.3
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: 1.7.3
run: powershell hack/configure-windows-ci.ps1
# TODO: Run unit tests
- name: "Run integration tests"
run: go test -v ./cmd/...
test-integration-freebsd:
name: FreeBSD
# "Larger" runner is needed for nested virtualization
# https://github.com/organizations/containerd/settings/actions/runners
runs-on: ubuntu-latest-4-cores
timeout-minutes: 20
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/cache@v3
with:
path: /root/.vagrant.d
key: vagrant-${{ matrix.box }}
- name: Set up vagrant
run: |
sudo apt-get update
sudo apt-get install -y libvirt-daemon libvirt-daemon-system vagrant vagrant-libvirt
sudo systemctl enable --now libvirtd
- name: Boot VM
run: |
ln -sf Vagrantfile.freebsd Vagrantfile
sudo vagrant up --no-tty
- name: test-unit
run: sudo vagrant up --provision-with=test-unit
- name: test-integration
run: sudo vagrant up --provision-with=test-integration