Skip to content

Commit

Permalink
Add square brackets for IP addresse when using jumper mode (#5164)
Browse files Browse the repository at this point in the history
When the testbed deployed in jumpber mode, if the testbed is an IPv6
testbed, the "scp" command will fail since both "scp" command and IPv6
address uses colon as an sepertor. So we need to add square bracket for
the IP address.

Signed-off-by: hjiajing <hjiajing@vmware.com>
  • Loading branch information
hjiajing committed Jun 30, 2023
1 parent 763c58e commit f32f796
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ci/jenkins/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ CONTROL_PLANE_NODE_ROLE="master|control-plane"

CLEAN_STALE_IMAGES="docker system prune --force --all --filter until=4h"
CLEAN_STALE_IMAGES_CONTAINERD="crictl rmi --prune"

PRINT_DOCKER_STATUS="docker system df -v"
PRINT_CONTAINERD_STATUS="crictl ps --state Exited"

Expand Down Expand Up @@ -629,7 +628,7 @@ function deliver_antrea {
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/jenkins_id_rsa" build/yamls/*.yml jenkins@[${control_plane_ip}]:~
elif [[ $TESTBED_TYPE == "jumper" ]]; then
control_plane_ip="$(kubectl get nodes -o wide --no-headers=true | awk -v role="$CONTROL_PLANE_NODE_ROLE" '$3 ~ role {print $6}')"
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/id_rsa" build/yamls/*.yml jenkins@${control_plane_ip}:${WORKDIR}/
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/id_rsa" build/yamls/*.yml jenkins@[${control_plane_ip}]:${WORKDIR}/
else
cp -f build/yamls/*.yml $WORKDIR
fi
Expand All @@ -650,8 +649,8 @@ function deliver_antrea {
kind load docker-image antrea/flow-aggregator:latest --name ${KIND_CLUSTER}
elif [[ $TESTBED_TYPE == "jumper" ]]; then
kubectl get nodes -o wide --no-headers=true | awk '{print $6}' | while read IP; do
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/id_rsa" antrea-ubuntu.tar jenkins@${IP}:${DEFAULT_WORKDIR}/antrea-ubuntu.tar
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/id_rsa" flow-aggregator.tar jenkins@${IP}:${DEFAULT_WORKDIR}/flow-aggregator.tar
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/id_rsa" antrea-ubuntu.tar jenkins@[${IP}]:${DEFAULT_WORKDIR}/antrea-ubuntu.tar
scp -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/id_rsa" flow-aggregator.tar jenkins@[${IP}]:${DEFAULT_WORKDIR}/flow-aggregator.tar
ssh -o StrictHostKeyChecking=no -i "${WORKDIR}/.ssh/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
else
Expand Down

0 comments on commit f32f796

Please sign in to comment.