Skip to content

Commit

Permalink
Merge pull request #2480 from spidernet-io/pr/welan/ci
Browse files Browse the repository at this point in the history
ci: retry  for curl
  • Loading branch information
weizhoublue committed Oct 29, 2023
2 parents d380f35 + e91b10a commit 2752f70
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-cherrypick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
echo "try to get PR from commit"
COMMIT=` echo "${JSON}" | jq '.event.commits[0].id' | tr -d '"' ` || true
if [ -n "${COMMIT}" ]; then
PR_NUMBER=`curl -s -H "Accept: application/vnd.github.groot-preview+json" https://api.github.com/repos/${{ github.repository }}/commits/${COMMIT}/pulls | jq -r '.[].number' `
PR_NUMBER=`curl --retry 10 -s -H "Accept: application/vnd.github.groot-preview+json" https://api.github.com/repos/${{ github.repository }}/commits/${COMMIT}/pulls | jq -r '.[].number' `
else
echo "error, failed to get any commit ID"
fi
Expand All @@ -63,7 +63,7 @@ jobs:
# [ -n "${PR_AUTHOR}" ] || { echo "no PR_AUTHOR, ignore" ; }
#
fi
RP_API_BODY=` curl https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} -s -H "Accept: application/vnd.github.groot-preview+json" `
RP_API_BODY=` curl --retry 10 https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER} -s -H "Accept: application/vnd.github.groot-preview+json" `
PR_COMMITS=` echo "${RP_API_BODY}" | jq ' .merge_commit_sha ' | tr -d '"' `
PR_AUTHOR=` echo "${RP_API_BODY}" | jq ' .user.login ' | tr -d '"' `
PR_URL="https://github.com/${{ github.repository }}/pull/${PR_NUMBER}"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-image-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ jobs:
id: get_event_version
continue-on-error: false
run: |
cni_latest_version=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/containernetworking/plugins/releases/latest | jq '.tag_name' | tr -d '"')
cni_latest_version=$(curl --retry 10 -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/containernetworking/plugins/releases/latest | jq '.tag_name' | tr -d '"')
if [ -z "${cni_latest_version}" ] ; then
echo "unable to get cni version" && exit 1
fi
ovs_latest_version=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/k8snetworkplumbingwg/ovs-cni/releases/latest | jq '.tag_name' | tr -d '"')
ovs_latest_version=$(curl --retry 10 -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/k8snetworkplumbingwg/ovs-cni/releases/latest | jq '.tag_name' | tr -d '"')
if [ -z "${ovs_latest_version}" ] ; then
echo "unable to get ovs version" && exit 1
fi
rdma_latest_version=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/k8snetworkplumbingwg/rdma-cni/releases/latest | jq '.tag_name' | tr -d '"')
rdma_latest_version=$(curl --retry 10 -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/k8snetworkplumbingwg/rdma-cni/releases/latest | jq '.tag_name' | tr -d '"')
if [ -z "${rdma_latest_version}" ] ; then
echo "unable to get rdma version" && exit 1
fi
Expand Down
2 changes: 2 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ ifeq ($(INSTALL_KUBEVIRT),true)
E2E_KUBECONFIG=$(E2E_KUBECONFIG) \
E2E_CLUSTER_NAME=$(E2E_CLUSTER_NAME) \
HTTP_PROXY=$(HTTP_PROXY) \
KUBEVIRT_VERSION=$(KUBEVIRT_VERSION) \
E2E_KUBEVIRT_IMAGE_REPO=$(E2E_KUBEVIRT_IMAGE_REPO) \
$(QUIET) bash scripts/install-kubevirt.sh
endif
@ echo "wait for the cluster ready" ; \
Expand Down
13 changes: 11 additions & 2 deletions test/Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ INSTALL_SPIDERDOCTOR ?= true

INSTALL_KUBEVIRT ?= false

CALICO_VERSION ?= v3.25.0

CNI_PACKAGE_VERSION ?= v1.3.0

#============ ginkgo-custom-flag ====================
Expand Down Expand Up @@ -203,3 +201,14 @@ ifeq ($(E2E_CHINA_IMAGE_REGISTRY),true)
else
E2E_SRIOV_IMAGE_REPO ?= ghcr.io
endif

#=========== kubevrit ============

# empty for latest
KUBEVIRT_VERSION :=

ifeq ($(E2E_CHINA_IMAGE_REGISTRY),true)
E2E_KUBEVIRT_IMAGE_REPO ?= quay.m.daocloud.io
else
E2E_KUBEVIRT_IMAGE_REPO ?= quay.io
endif
21 changes: 12 additions & 9 deletions test/scripts/install-kubevirt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ CURRENT_FILENAME=$( basename $0 )

[ -z "${HTTP_PROXY}" ] || export https_proxy=${HTTP_PROXY}

export KUBEVIRT_VERSION=$(curl -s https://api.github.com/repos/kubevirt/kubevirt/releases | grep tag_name | grep -v -- '-rc' | sort -r | head -1 | awk -F': ' '{print $2}' | sed 's/,//' | xargs)

# Should we set a fixed version just like "v1.1.0" ?
if [ -z "${KUBEVIRT_VERSION}" ] ; then
KUBEVIRT_VERSION=$( curl --retry 10 -s https://api.github.com/repos/kubevirt/kubevirt/releases/latest | jq '.tag_name' | tr -d '"' )
fi
[ -z "$KUBEVIRT_VERSION" ] && echo "error, miss KUBEVIRT_VERSION" && exit 1

echo "$CURRENT_FILENAME : KUBEVIRT_VERSION $KUBEVIRT_VERSION "

[ -z "$E2E_CLUSTER_NAME" ] && echo "error, miss E2E_CLUSTER_NAME " && exit 1
Expand All @@ -22,12 +23,14 @@ echo "$CURRENT_FILENAME : E2E_CLUSTER_NAME $E2E_CLUSTER_NAME "
[ ! -f "$E2E_KUBECONFIG" ] && echo "error, could not find file $E2E_KUBECONFIG " && exit 1
echo "$CURRENT_FILENAME : E2E_KUBECONFIG $E2E_KUBECONFIG "

KUBEVIRT_OPERATOR_IMAGE=quay.io/kubevirt/virt-operator:${KUBEVIRT_VERSION}
KUBEVIRT_API_IMAGE=quay.io/kubevirt/virt-api:${KUBEVIRT_VERSION}
KUBEVIRT_CONTROLLER_IMAGE=quay.io/kubevirt/virt-controller:${KUBEVIRT_VERSION}
KUBEVIRT_HANDLER_IMAGE=quay.io/kubevirt/virt-handler:${KUBEVIRT_VERSION}
KUBEVIRT_LAUNCHER_IMAGE=quay.io/kubevirt/virt-launcher:${KUBEVIRT_VERSION}
KUBEVIRT_TEST_IMAGE=quay.io/kubevirt/cirros-container-disk-demo
echo "E2E_KUBEVIRT_IMAGE_REPO=${E2E_KUBEVIRT_IMAGE_REPO}"

KUBEVIRT_OPERATOR_IMAGE=${E2E_KUBEVIRT_IMAGE_REPO}/kubevirt/virt-operator:${KUBEVIRT_VERSION}
KUBEVIRT_API_IMAGE=${E2E_KUBEVIRT_IMAGE_REPO}/kubevirt/virt-api:${KUBEVIRT_VERSION}
KUBEVIRT_CONTROLLER_IMAGE=${E2E_KUBEVIRT_IMAGE_REPO}/kubevirt/virt-controller:${KUBEVIRT_VERSION}
KUBEVIRT_HANDLER_IMAGE=${E2E_KUBEVIRT_IMAGE_REPO}/kubevirt/virt-handler:${KUBEVIRT_VERSION}
KUBEVIRT_LAUNCHER_IMAGE=${E2E_KUBEVIRT_IMAGE_REPO}/kubevirt/virt-launcher:${KUBEVIRT_VERSION}
KUBEVIRT_TEST_IMAGE=${E2E_KUBEVIRT_IMAGE_REPO}/kubevirt/cirros-container-disk-demo
KUBEVIRT_IMAGE_LIST="${KUBEVIRT_OPERATOR_IMAGE} ${KUBEVIRT_API_IMAGE} ${KUBEVIRT_CONTROLLER_IMAGE} ${KUBEVIRT_HANDLER_IMAGE} ${KUBEVIRT_LAUNCHER_IMAGE}"

LOCAL_IMAGE_LIST=`docker images | awk '{printf("%s:%s\n",$1,$2)}'`
Expand Down
2 changes: 1 addition & 1 deletion tools/scripts/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ for COMMIT in ${ALL_COMMIT} ; do
# https://docs.github.com/en/rest/overview/resources-in-the-rest-api?apiVersion=2022-11-28#rate-limiting
# When using GITHUB_TOKEN, the rate limit is 1,000 requests per hour per repository
# GitHub Enterprise Cloud's rate limit applies, and the limit is 15,000 requests per hour per repository.
COMMIT_INFO=` curl -s -H "Accept: application/vnd.github.groot-preview+json" -H "Authorization: Bearer ${GH_TOKEN}" https://api.github.com/repos/${PROJECT_REPO}/commits/${COMMIT}/pulls `
COMMIT_INFO=` curl --retry 10 -s -H "Accept: application/vnd.github.groot-preview+json" -H "Authorization: Bearer ${GH_TOKEN}" https://api.github.com/repos/${PROJECT_REPO}/commits/${COMMIT}/pulls `
PR=` jq -r '.[].number' <<< "${COMMIT_INFO}" `
[ -n "${PR}" ] || { echo "warning, failed to find PR number for commit ${COMMIT} " ; echo "${COMMIT_INFO}" ; echo "" ; continue ; }
if grep " ${PR} " <<< " ${PR_LIST} " &>/dev/null ; then
Expand Down

0 comments on commit 2752f70

Please sign in to comment.