Skip to content

Commit

Permalink
Merge pull request spidernet-io#2772 from ty-dc/ci/fix-calico-version
Browse files Browse the repository at this point in the history
e2e-fix: Use the default calico version when getting the calico version fails
  • Loading branch information
weizhoublue committed Dec 8, 2023
2 parents fbdc5a3 + a757ee6 commit 45f8ef7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ E2E_MULTUS_IMAGE_NAME ?= $(E2E_MULTUS_IMAGE_REGISTER)/k8snetworkplumbingwg/multu

#================= calico
CALICO_VERSION ?=
DEFAULT_CALICO_VERSION ?= v3.26.4

ifeq ($(E2E_CHINA_IMAGE_REGISTRY),true)
CALICO_IMAGE_REPO ?= docker.m.daocloud.io
Expand Down
6 changes: 3 additions & 3 deletions test/scripts/install-default-cni.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ CILIUM_CLUSTER_POD_SUBNET_V6=${CILIUM_CLUSTER_POD_SUBNET_V6:-"fd00:10:244::/112"
function install_calico() {
cp ${PROJECT_ROOT_PATH}/test/yamls/calico.yaml $CLUSTER_PATH/calico.yaml
if [ -z "${CALICO_VERSION}" ]; then
[ -n "${HTTP_PROXY}" ] && CALICO_VERSION=$(curl --retry 3 -x "${HTTP_PROXY}" -s https://api.github.com/repos/projectcalico/calico/releases/latest | jq -r '.tag_name')
[ -z "${HTTP_PROXY}" ] && CALICO_VERSION=$(curl --retry 3 -s https://api.github.com/repos/projectcalico/calico/releases/latest | jq -r '.tag_name')
[ "${CALICO_VERSION}" == "null" ] && { echo "failed get calico version"; exit 1; }
[ -n "${HTTP_PROXY}" ] && { CALICO_VERSION_INFO=$(curl --retry 3 --retry-delay 5 -x "${HTTP_PROXY}" -s https://api.github.com/repos/projectcalico/calico/releases/latest); echo ${CALICO_VERSION_INFO}; CALICO_VERSION=$(echo ${CALICO_VERSION_INFO} | jq -r '.tag_name'); }
[ -z "${HTTP_PROXY}" ] && { CALICO_VERSION_INFO=$(curl --retry 3 --retry-delay 5 -s https://api.github.com/repos/projectcalico/calico/releases/latest ); echo ${CALICO_VERSION_INFO}; CALICO_VERSION=$(echo ${CALICO_VERSION_INFO} | jq -r '.tag_name'); }
[ "${CALICO_VERSION}" == "null" ] && { echo "failed to get the calico version, will try to use default version."; CALICO_VERSION=${DEFAULT_CALICO_VERSION}; }
else
CALICO_VERSION=${CALICO_VERSION}
fi
Expand Down

0 comments on commit 45f8ef7

Please sign in to comment.