From a3fd3d90bc595b6f28131720ddb2a0175de510ff Mon Sep 17 00:00:00 2001 From: Fupan Li Date: Sun, 29 Sep 2024 15:19:40 +0800 Subject: [PATCH] ci: Add the sandbox api testcases A test case is added based on the intergrated cri-containerd case. The difference between cri containerd integrated testcase and sandbox api testcase is the "sandboxer" setting in the sandbox runtime handler. If the "sandboxer" is set to "" or "podsandbox", then containerd will use the legacy shimv2 api, and if the "sandboxer" is set to "shim", then it will use the sandbox api to launch the pod. In addition, add a containerd v2.0.0 version. Because containerd officially supports the sandbox api from version 2.0.0. Signed-off-by: Fupan Li --- .github/workflows/basic-ci-amd64.yaml | 46 +++++++++++++++++++ .../cri-containerd/integration-tests.sh | 2 + versions.yaml | 2 + 3 files changed, 50 insertions(+) diff --git a/.github/workflows/basic-ci-amd64.yaml b/.github/workflows/basic-ci-amd64.yaml index f0ea02ff34..fb07a12597 100644 --- a/.github/workflows/basic-ci-amd64.yaml +++ b/.github/workflows/basic-ci-amd64.yaml @@ -56,6 +56,51 @@ jobs: timeout-minutes: 10 run: bash tests/integration/cri-containerd/gha-run.sh run + run-containerd-sandboxapi: + strategy: + # We can set this to true whenever we're 100% sure that + # the all the tests are not flaky, otherwise we'll fail + # all the tests due to a single flaky instance. + fail-fast: false + matrix: + containerd_version: ['latest'] + vmm: ['dragonball', 'cloud-hypervisor', 'qemu-runtime-rs'] + runs-on: ubuntu-22.04 + env: + CONTAINERD_VERSION: ${{ matrix.containerd_version }} + GOPATH: ${{ github.workspace }} + KATA_HYPERVISOR: ${{ matrix.vmm }} + #the latest containerd from 2.0 need to set the CGROUP_DRIVER for e2e testing + CGROUP_DRIVER: "" + SANDBOXER: "shim" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.commit-hash }} + fetch-depth: 0 + + - name: Rebase atop of the latest target branch + run: | + ./tests/git-helper.sh "rebase-atop-of-the-latest-target-branch" + env: + TARGET_BRANCH: ${{ inputs.target-branch }} + + - name: Install dependencies + run: bash tests/integration/cri-containerd/gha-run.sh install-dependencies + + - name: get-kata-tarball + uses: actions/download-artifact@v4 + with: + name: kata-static-tarball-amd64${{ inputs.tarball-suffix }} + path: kata-artifacts + + - name: Install kata + run: bash tests/integration/cri-containerd/gha-run.sh install-kata kata-artifacts + + - name: Run containerd-sandboxapi tests + timeout-minutes: 10 + run: bash tests/integration/cri-containerd/gha-run.sh run + run-containerd-stability: strategy: fail-fast: false @@ -67,6 +112,7 @@ jobs: CONTAINERD_VERSION: ${{ matrix.containerd_version }} GOPATH: ${{ github.workspace }} KATA_HYPERVISOR: ${{ matrix.vmm }} + SANDBOXER: "podsandbox" steps: - uses: actions/checkout@v4 with: diff --git a/tests/integration/cri-containerd/integration-tests.sh b/tests/integration/cri-containerd/integration-tests.sh index fae8157841..a55706d5ad 100755 --- a/tests/integration/cri-containerd/integration-tests.sh +++ b/tests/integration/cri-containerd/integration-tests.sh @@ -25,6 +25,7 @@ KATA_HYPERVISOR="${KATA_HYPERVISOR:-qemu}" RUNTIME=${RUNTIME:-containerd-shim-kata-${KATA_HYPERVISOR}-v2} FACTORY_TEST=${FACTORY_TEST:-""} ARCH=$(uname -m) +SANDBOXER=${SANDBOXER:-"podsandbox"} containerd_runtime_type="io.containerd.kata-${KATA_HYPERVISOR}.v2" @@ -108,6 +109,7 @@ cat << EOF | sudo tee "${CONTAINERD_CONFIG_FILE}" default_runtime_name = "$runtime" [plugins.cri.containerd.runtimes.${runtime}] runtime_type = "${runtime_type}" + sandboxer = "${SANDBOXER}" $( [ $kata_annotations -eq 1 ] && \ echo 'pod_annotations = ["io.katacontainers.*"]' && \ echo ' container_annotations = ["io.katacontainers.*"]' diff --git a/versions.yaml b/versions.yaml index 20c647fcad..28b6327580 100644 --- a/versions.yaml +++ b/versions.yaml @@ -259,6 +259,8 @@ externals: version: "v1.6.8" lts: "v1.6" active: "v1.7" + # add containerd 2.0.0 for sandbox api test + latest: "v2.0" critools: description: "CLI tool for Container Runtime Interface (CRI)"