Skip to content

Commit

Permalink
Deliver test images to CAPV nodes to avoid rate limit issue
Browse files Browse the repository at this point in the history
Signed-off-by: Shuyang Xin <gavinx@vmware.com>
  • Loading branch information
XinShuYang committed Sep 5, 2024
1 parent b9f67f4 commit d724f05
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ci/jenkins/test-vmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ function copy_image {
${SSH_WITH_ANTREA_CI_KEY} -n capv@${IP} "sudo crictl images | grep '<none>' | 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.
Expand Down Expand Up @@ -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]}
Expand All @@ -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
Expand Down

0 comments on commit d724f05

Please sign in to comment.