Skip to content

Commit

Permalink
skip to remove all the kind testbed images to avoid rate limit issue
Browse files Browse the repository at this point in the history
Signed-off-by: KMAnju-2021 <[email protected]>
  • Loading branch information
KMAnju-2021 committed Sep 19, 2024
1 parent 84f60d2 commit b169ffc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
38 changes: 29 additions & 9 deletions ci/jenkins/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,13 @@ function clean_antrea {
for antrea_yml in ${WORKDIR}/*.yml; do
kubectl delete -f $antrea_yml --ignore-not-found=true || true
done
docker images --format "{{.Repository}}:{{.Tag}}" | grep 'antrea'| xargs -r docker rmi || true
docker images | grep '<none>' | awk '{print $3}' | xargs -r docker rmi || true
if [[ $TESTBED_TYPE == "kind-flexible-ipam" || $TESTBED_TYPE == "kind" ]]; then
docker images --format "{{.Repository}}:{{.Tag}}" | grep 'antrea' | grep -Ev 'antrea/toolbox:latest|antrea/ubuntu:22.04|antrea/golang:1.23|\
antrea/nginx:1.21.6-alpine|registry.k8s.io/e2e-test-images/agnhost:2.40|antrea/toolbox:1.3-0|antrea/mcjoin:v2.9|antrea/systemd-logs:v0.4|' | xargs -r docker rmi || true
else
docker images --format "{{.Repository}}:{{.Tag}}" | grep 'antrea'| xargs -r docker rmi -f || true
docker images | grep '<none>' | awk '{print $3}' | xargs -r docker rmi || true
fi
check_and_cleanup_docker_build_cache
}

Expand Down Expand Up @@ -519,6 +524,21 @@ function deliver_antrea_windows {
echo "==== Finish building and delivering Windows images ===="
}

function copy_kind_test_image {
common_images=("registry.k8s.io/e2e-test-images/agnhost:2.40" \
"antrea/nginx:1.21.6-alpine" "antrea/systemd-logs:v0.4" \
"antrea/toolbox:1.3-0" "antrea/toolbox:1.3-0" "antrea/mcjoin:v2.9" \
"registry.k8s.io/e2e-test-images/agnhost:2.40" "antrea/nginx:1.21.6-alpine" \
"antrea/antrea-agent-ubuntu:$BUILD_TAG" \
"antrea/antrea-controller-ubuntu:$BUILD_TAG" \
"antrea/flow-aggregator:$BUILD_TAG")

for image in "${common_images[@]}"; do
kind load docker-image $image --name ${KIND_CLUSTER}
sleep 1
done
}

function deliver_antrea {
echo "====== Cleanup Antrea Installation Before Delivering Antrea ======"
clean_antrea
Expand All @@ -535,10 +555,13 @@ function deliver_antrea {
export GOROOT=${GOLANG_RELEASE_DIR}/go
export GOCACHE="${WORKSPACE}/../gocache"
export PATH=${GOROOT}/bin:$PATH

git show --numstat
make clean
${CLEAN_STALE_IMAGES}
if [[ $TESTBED_TYPE != "kind" ]]; then
if [[ $TESTBED_TYPE != "kind-flexible-ipam" ]]; then
${CLEAN_STALE_IMAGES}
fi
fi
${PRINT_DOCKER_STATUS}
if [[ ! "${TESTCASE}" =~ "e2e" && "${DOCKER_REGISTRY}" != "" ]]; then
docker pull "${DOCKER_REGISTRY}/antrea/systemd-logs:v0.4"
Expand All @@ -550,11 +573,10 @@ function deliver_antrea {
DOCKER_REGISTRY="${DOCKER_REGISTRY}" ./hack/build-antrea-linux-all.sh --build-tag ${BUILD_TAG} --pull
IMG_TAG="${BUILD_TAG}" ./hack/generate-manifest.sh $MANIFEST_ARGS > build/yamls/antrea.yml
else
DOCKER_REGISTRY="${DOCKER_REGISTRY}" ./hack/build-antrea-linux-all.sh --pull
DOCKER_REGISTRY="${DOCKER_REGISTRY}" ./hack/build-antrea-linux-all.sh --testbed-type $TESTBED_TYPE --pull
./hack/generate-manifest.sh $MANIFEST_ARGS > build/yamls/antrea.yml
fi
make flow-aggregator-image

# Enable verbose log for troubleshooting.
sed -i "s/--v=0/--v=4/g" build/yamls/antrea.yml

Expand Down Expand Up @@ -606,9 +628,7 @@ function deliver_antrea {
ssh -o StrictHostKeyChecking=no -i "${WORKDIR}/jenkins_id_rsa" -n jenkins@${IP} "${CLEAN_STALE_IMAGES_CONTAINERD}; ${PRINT_CONTAINERD_STATUS}; ctr -n=k8s.io images import ${DEFAULT_WORKDIR}/antrea-ubuntu.tar; ctr -n=k8s.io images import ${DEFAULT_WORKDIR}/flow-aggregator.tar" || true
done
elif [[ $TESTBED_TYPE == "kind" ]]; then
kind load docker-image antrea/antrea-agent-ubuntu:$BUILD_TAG --name ${KIND_CLUSTER}
kind load docker-image antrea/antrea-controller-ubuntu:$BUILD_TAG --name ${KIND_CLUSTER}
kind load docker-image antrea/flow-aggregator:latest --name ${KIND_CLUSTER}
copy_kind_test_image
kubectl config use-context kind-${KIND_CLUSTER}
docker cp ./build/yamls/antrea.yml ${KIND_CLUSTER}-control-plane:/root/antrea.yml
elif [[ $TESTBED_TYPE == "jumper" ]]; then
Expand Down
13 changes: 10 additions & 3 deletions hack/build-antrea-linux-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ COVERAGE=false
PLATFORM=""
DISTRO="ubuntu"
BUILD_TAG=""
TESTBED_TYPE=""

while [[ $# -gt 0 ]]
do
Expand All @@ -53,6 +54,10 @@ case $key in
PULL=true
shift
;;
--testbed-type)
TESTBED_TYPE="$2"
shift 2
;;
--push-base-images)
PUSH=true
shift
Expand Down Expand Up @@ -140,9 +145,11 @@ if $PULL; then
docker pull $PLATFORM_ARG ubuntu:24.04
docker pull $PLATFORM_ARG golang:$GO_VERSION
else
docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:24.04
docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:24.04 ubuntu:24.04
docker pull ${DOCKER_REGISTRY}/antrea/golang:$GO_VERSION
if [[ $TESTBED_TYPE != "kind" && $TESTBED_TYPE != "kind-flexible-ipam" ]]; then
docker pull ${DOCKER_REGISTRY}/antrea/ubuntu:22.04
docker pull ${DOCKER_REGISTRY}/antrea/golang:$GO_VERSION
fi
docker tag ${DOCKER_REGISTRY}/antrea/ubuntu:22.04 ubuntu:22.04
docker tag ${DOCKER_REGISTRY}/antrea/golang:$GO_VERSION golang:$GO_VERSION
fi
if [ "$DISTRO" == "ubi" ]; then
Expand Down

0 comments on commit b169ffc

Please sign in to comment.