From d724f05df04177b392b2335c9fc83dcb950ce01c Mon Sep 17 00:00:00 2001 From: Shuyang Xin Date: Thu, 5 Sep 2024 15:13:05 +0800 Subject: [PATCH] Deliver test images to CAPV nodes to avoid rate limit issue Signed-off-by: Shuyang Xin --- ci/jenkins/test-vmc.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ci/jenkins/test-vmc.sh b/ci/jenkins/test-vmc.sh index 1ce62dfe891..38b719d9523 100755 --- a/ci/jenkins/test-vmc.sh +++ b/ci/jenkins/test-vmc.sh @@ -301,6 +301,19 @@ function copy_image { ${SSH_WITH_ANTREA_CI_KEY} -n capv@${IP} "sudo crictl images | grep '' | awk '{print \$3}' | xargs -r crictl rmi" } +function copy_test_image { + image=$1 + IP=$2 + tag=$3 + + docker pull ${image} && docker save -o image.tar ${image} + ${SCP_WITH_ANTREA_CI_KEY} image.tar capv@${IP}:/home/capv + ${SSH_WITH_ANTREA_CI_KEY} -n capv@${IP} "sudo ctr -n=k8s.io images import /home/capv/image.tar" + if [ -n "$tag" ]; then + ${SSH_WITH_ANTREA_CI_KEY} -n capv@${IP} "sudo ctr -n=k8s.io images tag $image $tag --force" + fi +} + # We run the function in a subshell with "set -e" to ensure that it exits in # case of error (e.g. integrity check), no matter the context in which the # function is called. @@ -431,6 +444,9 @@ function deliver_antrea { ${SCP_WITH_ANTREA_CI_KEY} $GIT_CHECKOUT_DIR/build/yamls/*.yml capv@${control_plane_ip}:~ IPs=($(kubectl get nodes -o wide --no-headers=true | awk '{print $6}' | xargs)) + antrea_images=("registry.k8s.io/e2e-test-images/agnhost:2.40" "antrea/nginx:1.21.6-alpine" "antrea/sonobuoy:v0.56.16" "antrea/toolbox:1.3-0") + k8s_images=("registry.k8s.io/e2e-test-images/agnhost:2.45" "registry.k8s.io/e2e-test-images/jessie-dnsutils:1.5" "registry.k8s.io/e2e-test-images/nginx:1.14-2") + e2e_images=("k8sprow.azurecr.io/kubernetes-e2e-test-images/agnhost:2.45" "k8sprow.azurecr.io/kubernetes-e2e-test-images/jessie-dnsutils:1.5" "k8sprow.azurecr.io/kubernetes-e2e-test-images/nginx:1.14-2") for i in "${!IPs[@]}" do ssh-keygen -f "/var/lib/jenkins/.ssh/known_hosts" -R ${IPs[$i]} @@ -443,6 +459,12 @@ function deliver_antrea { copy_image antrea-controller-ubuntu.tar docker.io/antrea/antrea-controller-ubuntu ${IPs[$i]} ${DOCKER_IMG_VERSION} true copy_image flow-aggregator.tar docker.io/antrea/flow-aggregator ${IPs[$i]} ${DOCKER_IMG_VERSION} true fi + for image in "${antrea_images[@]}"; do + copy_test_image ${image} ${IPs[$i]} + done + for k in "${!k8s_images[@]}"; do + copy_test_image ${k8s_images[$k]} ${IPs[$i]} ${e2e_images[$k]} + done done if [[ -z $OLD_ANTREA_VERSION ]]; then