From fdf3e20b6cf859f71c5ed3e82a83bad1a61b2b40 Mon Sep 17 00:00:00 2001 From: chengxiangdong Date: Mon, 19 Aug 2024 13:48:33 +0800 Subject: [PATCH] fix workflow --- .github/workflows/ci.yml | 2 +- .../huawei-cloud-controller-manager.yaml | 2 ++ hack/pre-run-e2e.sh | 23 +++++++++++-------- hack/run-e2e.sh | 8 +++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ce689a63..409e526dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: - name: run e2e run: | export ARTIFACTS_PATH=${{ github.workspace }}/e2e-logs - sh hack/run-e2e.sh + ./hack/run-e2e.sh - name: upload logs if: always() uses: actions/upload-artifact@v3 diff --git a/hack/deploy/huawei-cloud-controller-manager.yaml b/hack/deploy/huawei-cloud-controller-manager.yaml index e36833b77..1441818a2 100644 --- a/hack/deploy/huawei-cloud-controller-manager.yaml +++ b/hack/deploy/huawei-cloud-controller-manager.yaml @@ -169,6 +169,8 @@ spec: effect: NoSchedule - key: node-role.kubernetes.io/control-plane effect: NoSchedule + - key: node-role.kubernetes.io/controlplane + effect: NoSchedule serviceAccountName: cloud-controller-manager containers: - name: huawei-cloud-controller-manager diff --git a/hack/pre-run-e2e.sh b/hack/pre-run-e2e.sh index 468eb9665..75e6034d3 100755 --- a/hack/pre-run-e2e.sh +++ b/hack/pre-run-e2e.sh @@ -22,12 +22,22 @@ export REGISTRY_SERVER_ADDRESS=swr.ap-southeast-1.myhuaweicloud.com export REGISTRY=${REGISTRY_SERVER_ADDRESS}/cloud-native export VERSION=v$(echo $RANDOM | sha1sum |cut -c 1-5) -echo -e "\nBuild images" +echo -e "\n:::::: Check KUBECONFIG ::::::" +echo "KUBECONFIG="$KUBECONFIG + +echo -e "\n:::::: Check cloud-config Secret ::::::" +count=$(kubectl get -n kube-system secret | grep cloud-config | wc -l) +if [[ "$count" -ne 1 ]]; then + echo ":::::: Please create the cloud-config secret." + exit 1 +fi + +echo -e "\n:::::: Build images ::::::" # todo: Maybe we need load the image to target cluster node. make image-huawei-cloud-controller-manager tmpPath=$(mktemp -d) -is_containerd=`command -v containerd` +is_containerd=$(command -v containerd) echo "is_containerd: ${is_containerd}" if [[ -x ${is_containerd} ]]; then docker save -o "${tmpPath}/huawei-cloud-controller-manager.tar" ${REGISTRY}/huawei-cloud-controller-manager:${VERSION} @@ -35,17 +45,10 @@ if [[ -x ${is_containerd} ]]; then rm -rf ${tmpPath}/huawei-cloud-controller-manager.tar fi -echo -e "\nCheck cloud-config secret" -count=`kubectl get -n kube-system secret cloud-config | grep cloud-config | wc -l` -if [[ "$count" -ne 1 ]]; then - echo "Please create the cloud-config secret." - exit 1 -fi - # Remove the existing provider if it exists. kubectl delete -n kube-system deployment --ignore-not-found=true huawei-cloud-controller-manager -echo -e "\nDeploy huawei-cloud-controller-manager" +echo -e "\n:::::: Deploy huawei-cloud-controller-manager ::::::" REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. image_url=${REGISTRY}/huawei-cloud-controller-manager:${VERSION} diff --git a/hack/run-e2e.sh b/hack/run-e2e.sh index 49f9750b4..30d1e58af 100755 --- a/hack/run-e2e.sh +++ b/hack/run-e2e.sh @@ -31,21 +31,21 @@ GOPATH=$(go env GOPATH | awk -F ':' '{print $1}') export PATH=$PATH:$GOPATH/bin # Pre run e2e for extra components -echo -e "\nRun pre run e2e" +echo -e "\n:::::: Run pre run e2e ::::::" "${REPO_ROOT}"/hack/pre-run-e2e.sh # Run e2e -echo -e "\nRun e2e" +echo -e "\n:::::: Run e2e ::::::" set +e ginkgo -v --race --trace --fail-fast -p --randomize-all ./test/e2e/ TESTING_RESULT=$? # Collect logs kubectl logs deployment/huawei-cloud-controller-manager -n kube-system > ${ARTIFACTS_PATH}/huawei-cloud-controller-manager.log -echo -e "\nCollected logs at ${ARTIFACTS_PATH}:" +echo -e "\n:::::: Collected logs at ${ARTIFACTS_PATH}:" # Post run e2e for delete extra components -echo -e "\nRun post run e2e" +echo -e "\n:::::: Run post run e2e ::::::" "${REPO_ROOT}"/hack/post-run-e2e.sh exit $TESTING_RESULT