Skip to content

Commit

Permalink
Add clean egress
Browse files Browse the repository at this point in the history
Signed-off-by: bzsuni <[email protected]>
  • Loading branch information
bzsuni committed Feb 21, 2024
1 parent 14aaeaf commit 0452110
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/call-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)"; \
Expand Down

0 comments on commit 0452110

Please sign in to comment.