You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/12/13 09:37:15 UTC

[camel-k] 03/10: fix(e2e): avoid using subshell for running kustomize commands

This is an automated email from the ASF dual-hosted git repository.

tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit cef27e24299abc5d449bcd1479239202cb8812df
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Thu Dec 8 13:53:25 2022 +0900

    fix(e2e): avoid using subshell for running kustomize commands
---
 install/Makefile | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/install/Makefile b/install/Makefile
index 6854f83b2..d93bde218 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -83,8 +83,8 @@ INT_PLATFORM_PATCH := patch-integration-platform
 #
 define set-kustomize-image
 	$(if $(filter $(IMAGE_NAME),$(CUSTOM_IMAGE):$(CUSTOM_VERSION)),,\
-
-		@cd $(1) && $(KUSTOMIZE) edit set image $(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION))
+		@cd $(1) || exit 1 && \
+			$(KUSTOMIZE) edit set image $(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION))
 endef
 
 #
@@ -94,7 +94,8 @@ endef
 # Parameter: directory of the kustomization.yaml
 #
 define set-kustomize-namespace
-	@cd $(1) && $(KUSTOMIZE) edit set namespace $(NAMESPACE)
+	@cd $(1) || exit 1 && \
+		$(KUSTOMIZE) edit set namespace $(NAMESPACE)
 endef
 
 #
@@ -108,16 +109,16 @@ endef
 # * kind of resources, eg. Deployment, Role
 #
 define add-remove-kind-patch
-	@(cd $(1) && \
-		$(KUSTOMIZE) edit $(2) patch --path $(3) --kind $(4) &> /dev/null)
+	@cd $(1) || exit 1 && \
+		$(KUSTOMIZE) edit $(2) patch --path $(3) --kind $(4) &> /dev/null
 endef
 
 #
 # Macro for adding / removing the prometheus resources for monitoring
 #
 define add-remove-operator-monitoring
-	@(cd $(1) && \
-		$(KUSTOMIZE) edit $(2) resource ../$(CONFIG)/prometheus &> /dev/null)
+	@cd $(1) || exit 1 && \
+		$(KUSTOMIZE) edit $(2) resource ../$(CONFIG)/prometheus &> /dev/null
 endef
 
 .PHONY: have-platform check_admin setup-cluster .setup-kubernetes .setup-openshift setup
@@ -187,7 +188,9 @@ setup-cluster: check-admin check-crd-api-support have-platform kustomize kubectl
 	@$(call set-kustomize-namespace,$@)
 ifeq ($(PLATFORM), openshift)
 	@for res in $(RBAC_OS)/operator-cluster*; do \
-		(cd $@ && $(KUSTOMIZE) edit add resource ../$$res); \
+		cd $@ || exit 1 && \
+			$(KUSTOMIZE) edit add resource ../$$res && \
+			cd - &> /dev/null; \
 	done
 endif
 #
@@ -233,7 +236,9 @@ else
 endif
 ifeq ($(PLATFORM), openshift)
 	@for res in $(RBAC_OS)/operator-role*; do \
-		(cd $@ && $(KUSTOMIZE) edit add resource ../$$res); \
+		cd $@ || exit 1 && \
+			$(KUSTOMIZE) edit add resource ../$$res && \
+			cd - &> /dev/null; \
 	done
 endif
 #