From 04521105f1b555835a4716743891f5d5708cd3a4 Mon Sep 17 00:00:00 2001 From: bzsuni Date: Mon, 29 Jan 2024 22:57:44 +0800 Subject: [PATCH] Add clean egress Signed-off-by: bzsuni --- .github/workflows/call-e2e.yaml | 17 ++++++++++++++--- Makefile | 4 ++++ test/Makefile | 10 +++++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/call-e2e.yaml b/.github/workflows/call-e2e.yaml index e3044fe73..64bf70af0 100644 --- a/.github/workflows/call-e2e.yaml +++ b/.github/workflows/call-e2e.yaml @@ -144,9 +144,9 @@ jobs: -e E2E_GINKGO_LABELS=${E2E_LABELS} \ -e E2E_IP_FAMILY=${{ inputs.ipfamily }} -e CNI=${{ env.cni }}} || RESULT=1 if ((RESULT==0)) ; then - echo "RUN_PASS=true" >> $GITHUB_ENV + echo "RUN_E2E_PASS=true" >> $GITHUB_ENV else - echo "RUN_PASS=false" >> $GITHUB_ENV + echo "RUN_E2E_PASS=false" >> $GITHUB_ENV fi if [ -f "${{ env.E2E_LOG_PATH }}" ] ; then echo "RUN_UPLOAD_LOG=true" >> $GITHUB_ENV @@ -174,9 +174,20 @@ jobs: path: ${{ env.E2E_GINKGO_REPORT_PATH }} retention-days: 30 + - name: helm uninstalls egress + id: clean + run: | + RESULT=0 + make clean_e2e_egress -e E2E_KIND_CLUSTER_NAME=${{ env.RUN_KIND_CLUSTER_NAME }} || RESULT=1 + if ((RESULT==0)) ; then + echo "CLEAN_E2E_PASS=true" >> $GITHUB_ENV + else + echo "CLEAN_E2E_PASS=false" >> $GITHUB_ENV + fi + - name: Show e2e Result run: | - if ${{ env.RUN_PASS == 'true' }} ;then + if ${{ env.RUN_E2E_PASS == 'true' && env.CLEAN_E2E_PASS == 'true'}} ;then exit 0 else exit 1 diff --git a/Makefile b/Makefile index 761c24af9..7dcc76137 100644 --- a/Makefile +++ b/Makefile @@ -397,6 +397,10 @@ e2e_run: e2e_clean: make -C test clean +.PHONY: clean_e2e_egress +clean_e2e_egress: + -$(QUIET) make -C test uninstall_egress + #============ doc diff --git a/test/Makefile b/test/Makefile index bb4f8b830..83cd4619a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -281,6 +281,14 @@ deploy_project: || { KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) ./scripts/debugCluster.sh $(KIND_KUBECONFIG) "detail" $(E2E_NAMESPACE) ; exit 1 ; } ; \ exit 0 +.PHONY: uninstall_egress +uninstall_egress: KIND_KUBECONFIG ?= $(E2E_KIND_KUBECONFIG_PATH) +uninstall_egress: KIND_CLUSTER_NAME ?= $(E2E_KIND_CLUSTER_NAME) +uninstall_egress: + @echo -e "\033[35m [helm uninstall egress] \033[0m" + helm uninstall project --wait --debug -n $(E2E_NAMESPACE) \ + --kubeconfig=$(KIND_KUBECONFIG) || { $(KIND_CLUSTER_NAME) ./scripts/debugCluster.sh $(KIND_KUBECONFIG) "detail" $(E2E_NAMESPACE) ; exit 1 ; } ; \ + kubectl --kubeconfig=$(KIND_KUBECONFIG) get all --all-namespaces | grep -q "egressgateway"` && { echo "error: found egressgateway resources" ; exit 1 ; } # test kind is ok .PHONY: install_example_app @@ -323,7 +331,7 @@ e2e_test: @echo -e "\033[35mRun e2e testing on the cluster $(KIND_CLUSTER_NAME) \033[0m" @echo -e "\033[35m label=$(E2E_GINKGO_LABELS)\n timeout=$(E2E_TIMEOUT) \n options=$(E2E_GINKGO_OPTION) \n egress_namespace=$(E2E_NAMESPACE) \033[0m" @echo -e "\033[35m[STEP1]\033[0m check KUBECONFIG file path"; \ - export KUBECONFIG=$(KIND_KUBECONFIG) ; [ -f "$(KIND_KUBECONFIG)" ] || { echo -e "error, does not exist KUBECONFIG $(E2E_KUBECONFIG)" ; exit 1 ; } ; \ + export KUBECONFIG=$(KIND_KUBECONFIG) ; [ -f "$(KIND_KUBECONFIG)" ] || { echo -e "error, does not exist KUBECONFIG $(KIND_KUBECONFIG)" ; exit 1 ; } ; \ echo -e "success" ; \ echo -e "\033[35m[STEP2]\033[0m clean old e2e log file"; \ [ -f "$(E2E_LOG_FILE)" ] && rm -f "$(E2E_LOG_FILE)"; \