Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests with the latest unreleased (a.k.a master) containerd #257

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Nightly
on:
schedule:
- cron: '0 0 * * *' # Every day at midnight
pull_request:
paths:
- '.github/workflows/nightly.yml'

# This nightly test helps us to track changes on containerd on daily basis
# and enable us to quickly fix snapshotter when some of recent changes on
# containerd cause incompatibility with this snapshotter.
#
# TODO1(ktock): Output binaries if needed.
# TODO2(ktock): Ideally, this test should be invoked in containerd/containerd's CI on each PR.
# This will make sure that each commit merged into containerd/containerd safely
# works with stargz snapshotter.

env:
DOCKER_BUILDKIT: 1
DOCKER_BUILD_ARGS: --build-arg=CONTAINERD_VERSION=master # do tests with the latest containerd

jobs:
integration:
runs-on: ubuntu-20.04
name: Integration
steps:
- name: Install htpasswd for setting up private registry
run: sudo apt-get update -y && sudo apt-get --no-install-recommends install -y apache2-utils
- uses: actions/checkout@v2
- name: Run integration test
run: make integration

test-optimize:
runs-on: ubuntu-20.04
name: Optimize
steps:
- name: Install htpasswd for setting up private registry
run: sudo apt-get update -y && sudo apt-get --no-install-recommends install -y apache2-utils
- uses: actions/checkout@v2
- name: Run test for optimize subcommand of ctr-remote
run: make test-optimize

test-pullsecrets:
runs-on: ubuntu-20.04
name: PullSecrets
steps:
- name: Install htpasswd for setting up private registry
run: sudo apt-get update -y && sudo apt-get --no-install-recommends install -y apache2-utils
- uses: actions/checkout@v2
- name: Run test for pulling image from private registry on Kubernetes
run: make test-pullsecrets

test-cri:
runs-on: ubuntu-20.04
name: CRIValidation
steps:
- uses: actions/checkout@v2
- name: Varidate the runtime through CRI
run: make test-cri
46 changes: 38 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,91 @@ env:

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Build
steps:
- uses: actions/checkout@v2
- name: Build all
run: ./script/util/make.sh build -j2

test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Test
steps:
- uses: actions/checkout@v2
- name: Test all
run: ./script/util/make.sh test-all -j2

linter:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Linter
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Run Linter
run: ./script/util/make.sh install-check-tools check

integration:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Integration
strategy:
fail-fast: false
matrix:
buildargs: ["", "--build-arg=CONTAINERD_VERSION=master"] # released version & master version
steps:
- name: Install htpasswd for setting up private registry
run: sudo apt-get update -y && sudo apt-get --no-install-recommends install -y apache2-utils
- uses: actions/checkout@v2
- name: Run integration test
env:
DOCKER_BUILD_ARGS: ${{ matrix.buildargs }}
run: make integration

test-optimize:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: Optimize
strategy:
fail-fast: false
matrix:
buildargs: ["", "--build-arg=CONTAINERD_VERSION=master"] # released version & master version
steps:
- name: Install htpasswd for setting up private registry
run: sudo apt-get update -y && sudo apt-get --no-install-recommends install -y apache2-utils
- uses: actions/checkout@v2
- name: Run test for optimize subcommand of ctr-remote
env:
DOCKER_BUILD_ARGS: ${{ matrix.buildargs }}
run: make test-optimize

test-pullsecrets:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: PullSecrets
strategy:
fail-fast: false
matrix:
buildargs: ["", "--build-arg=CONTAINERD_VERSION=master"] # released version & master version
steps:
- name: Install htpasswd for setting up private registry
run: sudo apt-get update -y && sudo apt-get --no-install-recommends install -y apache2-utils
- uses: actions/checkout@v2
- name: Run test for pulling image from private registry on Kubernetes
env:
DOCKER_BUILD_ARGS: ${{ matrix.buildargs }}
run: make test-pullsecrets

test-cri:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
name: CRIValidation
strategy:
fail-fast: false
matrix:
buildargs: ["", "--build-arg=CONTAINERD_VERSION=master"] # released version & master version
steps:
- uses: actions/checkout@v2
- name: Varidate the runtime through CRI
env:
DOCKER_BUILD_ARGS: ${{ matrix.buildargs }}
run: make test-cri

#
Expand All @@ -71,7 +101,7 @@ jobs:

project:
name: Project Checks
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ COPY --from=snapshotter-dev /out/* /
# `docker-ce-cli` is used only for users to `docker login` to registries (e.g. DockerHub)
# with configuring ~/.docker/config.json
FROM golang-base AS containerd-base
ARG TARGETARCH
RUN apt-get update -y && apt-get --no-install-recommends install -y fuse \
apt-transport-https gnupg2 software-properties-common && \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
"deb [arch=${TARGETARCH:-amd64}] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
apt-get update -y && apt-get --no-install-recommends install -y docker-ce-cli
COPY --from=containerd-dev /out/bin/containerd /out/bin/containerd-shim-runc-v2 /usr/local/bin/
COPY --from=runc-dev /out/sbin/* /usr/local/sbin/
Expand Down
19 changes: 0 additions & 19 deletions script/benchmark/config/config.cni.conflist

This file was deleted.

10 changes: 3 additions & 7 deletions script/benchmark/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ BENCHMARKING_BASE_IMAGE_NAME="benchmark-image-base"
BENCHMARKING_NODE_IMAGE_NAME="benchmark-image-test"
BENCHMARKING_NODE=hello-bench
BENCHMARKING_CONTAINER=hello-bench-container
BENCHMARKING_CNI_PLUGIN_URL="https://github.com/containernetworking/plugins/releases/download/v0.8.7/cni-plugins-linux-amd64-v0.8.7.tgz"

if [ "${BENCHMARKING_NO_RECREATE:-}" != "true" ] ; then
echo "Preparing node image..."
docker build -t "${BENCHMARKING_BASE_IMAGE_NAME}" --target snapshotter-base \
${DOCKER_BUILD_ARGS:-} "${REPO}"
docker build ${DOCKER_BUILD_ARGS:-} -t "${BENCHMARKING_BASE_IMAGE_NAME}" \
--target snapshotter-base "${REPO}"
fi

DOCKER_COMPOSE_YAML=$(mktemp)
Expand All @@ -47,9 +46,7 @@ cat <<EOF > "${TMP_CONTEXT}/Dockerfile"
FROM ${BENCHMARKING_BASE_IMAGE_NAME}

RUN apt-get update -y && \
apt-get --no-install-recommends install -y python jq iptables && \
update-alternatives --set iptables /usr/sbin/iptables-legacy && \
mkdir -p /opt/cni/bin && curl -Ls "${BENCHMARKING_CNI_PLUGIN_URL}" | tar xzv -C /opt/cni/bin && \
apt-get --no-install-recommends install -y python jq && \
git clone https://github.com/google/go-containerregistry \
\${GOPATH}/src/github.com/google/go-containerregistry && \
cd \${GOPATH}/src/github.com/google/go-containerregistry && \
Expand All @@ -58,7 +55,6 @@ RUN apt-get update -y && \

COPY ./config/config.containerd.toml /etc/containerd/config.toml
COPY ./config/config.stargz.toml /etc/containerd-stargz-grpc/config.toml
COPY ./config/config.cni.conflist /etc/cni/net.d/optimizer.conflist

ENV CONTAINERD_SNAPSHOTTER=""

Expand Down
1 change: 1 addition & 0 deletions script/cri/const.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ set -euo pipefail

NODE_BASE_IMAGE_NAME="cri-image-base"
NODE_TEST_IMAGE_NAME="cri-image-test"
PREPARE_NODE_IMAGE="cri-prepare-image"
13 changes: 3 additions & 10 deletions script/cri/mirror.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

set -euo pipefail

CONTAINERD_VERSION="1.4.3"
RUNC_VERSION="v1.0.0-rc92"
if [ "${TOOLS_DIR}" == "" ] ; then
echo "tools dir must be provided"
exit 1
Expand Down Expand Up @@ -46,18 +44,13 @@ function retry {
fi
}

apt-get update -y && apt-get --no-install-recommends install -y wget
wget https://github.com/opencontainers/runc/releases/download/"${RUNC_VERSION}"/runc.amd64 -O /bin/runc
chmod 755 /bin/runc
wget https://github.com/containerd/containerd/releases/download/v"${CONTAINERD_VERSION}"/containerd-"${CONTAINERD_VERSION}"-linux-amd64.tar.gz
tar zxf containerd-1.4.3-linux-amd64.tar.gz -C /
containerd &
retry ctr version

cd "${SS_REPO}"
PREFIX=/out/ make ctr-remote
mv /out/ctr-remote /bin/ctr-remote

containerd &
retry ctr-remote version

HOST=$(cat "${HOST_FILE}")
cat "${LIST_FILE}" | sort | uniq | while read IMAGE ; do
MIRROR_URL="${HOST}"$(echo "${IMAGE}" | sed -E 's/^[^/]*//g' | sed -E 's/@.*//g')
Expand Down
8 changes: 7 additions & 1 deletion script/cri/test-legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ done

# If container started successfully, varidate the runtime through CRI
if [ "${FAIL}" == "" ] ; then
if ! docker exec -i "${TEST_NODE_ID}" /go/bin/critest --runtime-endpoint=${CONTAINERD_SOCK} ; then
if ! (
echo "===== VERSION INFORMATION =====" && \
docker exec "${TEST_NODE_ID}" runc --version && \
docker exec "${TEST_NODE_ID}" containerd --version && \
echo "===============================" && \
docker exec -i "${TEST_NODE_ID}" /go/bin/critest --runtime-endpoint=${CONTAINERD_SOCK}
) ; then
FAIL=true
fi
fi
Expand Down
6 changes: 5 additions & 1 deletion script/cri/test-stargz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ services:
- "critest-containerd-data:/var/lib/containerd"
- "critest-containerd-stargz-grpc-data:/var/lib/containerd-stargz-grpc"
image-prepare:
image: golang:1.15-buster
image: "${PREPARE_NODE_IMAGE}"
container_name: "${PREPARE_NODE_NAME}"
privileged: true
entrypoint:
Expand Down Expand Up @@ -168,6 +168,10 @@ if [ "${CONNECTED}" != "true" ] ; then
echo "Failed to connect to containerd"
exit 1
fi
echo "===== VERSION INFORMATION ====="
docker exec "${TEST_NODE_NAME}" runc --version
docker exec "${TEST_NODE_NAME}" containerd --version
echo "==============================="
docker exec "${TEST_NODE_NAME}" /go/bin/critest --runtime-endpoint=${CONTAINERD_SOCK}

# Check if stargz snapshotter is working
Expand Down
9 changes: 7 additions & 2 deletions script/cri/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ source "${CONTEXT}/const.sh"

if [ "${CRI_NO_RECREATE:-}" != "true" ] ; then
echo "Preparing node image..."
docker build -t "${NODE_BASE_IMAGE_NAME}" "${REPO}"
docker build ${DOCKER_BUILD_ARGS:-} -t "${NODE_BASE_IMAGE_NAME}" "${REPO}"
docker build ${DOCKER_BUILD_ARGS:-} -t "${PREPARE_NODE_IMAGE}" --target containerd-base "${REPO}"
fi

TMP_CONTEXT=$(mktemp -d)
Expand All @@ -38,12 +39,16 @@ trap 'cleanup "$?"' EXIT SIGHUP SIGINT SIGQUIT SIGTERM

# Prepare the testing node
cat <<EOF > "${TMP_CONTEXT}/Dockerfile"
# Legacy builder that doesn't support TARGETARCH should set this explicitly using --build-arg.
# If TARGETARCH isn't supported by the builder, the default value is "amd64".

FROM ${NODE_BASE_IMAGE_NAME}
ARG TARGETARCH

ENV PATH=$PATH:/usr/local/go/bin
ENV GOPATH=/go
RUN apt install -y --no-install-recommends git make gcc build-essential jq && \
curl https://dl.google.com/go/go1.15.6.linux-amd64.tar.gz \
curl https://dl.google.com/go/go1.15.6.linux-\${TARGETARCH:-amd64}.tar.gz \
| tar -C /usr/local -xz && \
go get -u github.com/onsi/ginkgo/ginkgo && \
git clone -b v1.19.0 https://github.com/kubernetes-sigs/cri-tools \
Expand Down
5 changes: 5 additions & 0 deletions script/integration/containerd/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ function reboot_containerd {
retry ctr snapshots --snapshotter="${PLUGIN}" prepare "connectiontest-dummy-${UNIQUE_SUFFIX}" ""
}

echo "===== VERSION INFORMATION ====="
containerd --version
runc --version
echo "==============================="

echo "Logging into the registry..."
cp /auth/certs/domain.crt /usr/local/share/ca-certificates
update-ca-certificates
Expand Down
5 changes: 2 additions & 3 deletions script/integration/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ if [ "${INTEGRATION_NO_RECREATE:-}" != "true" ] ; then
echo "Preparing node image..."

# Enable to check race
docker build -t "${INTEGRATION_BASE_IMAGE_NAME}" \
docker build ${DOCKER_BUILD_ARGS:-} -t "${INTEGRATION_BASE_IMAGE_NAME}" \
--target snapshotter-base \
--build-arg=SNAPSHOTTER_BUILD_FLAGS="-race" \
${DOCKER_BUILD_ARGS:-} \
"${REPO}"
fi

Expand Down Expand Up @@ -80,7 +79,7 @@ ENV CONTAINERD_SNAPSHOTTER=""

ENTRYPOINT [ "/entrypoint.sh" ]
EOF
docker build -t "${INTEGRATION_TEST_IMAGE_NAME}" ${DOCKER_BUILD_ARGS:-} "${TMP_CONTEXT}"
docker build ${DOCKER_BUILD_ARGS:-} -t "${INTEGRATION_TEST_IMAGE_NAME}" ${DOCKER_BUILD_ARGS:-} "${TMP_CONTEXT}"

echo "Preparing creds..."
prepare_creds "${AUTH_DIR}" "${REGISTRY_HOST}" "${DUMMYUSER}" "${DUMMYPASS}"
Expand Down
Loading