From a6e919076fc2e7ec608b14a90a9ad578f1191631 Mon Sep 17 00:00:00 2001 From: rohitagg2020 Date: Mon, 21 Mar 2022 15:05:53 +0530 Subject: [PATCH 1/4] Moving the call to configureGlobal down Moving the call to configureGlobal down as it should happen for kapp completion bash command also. --- hack/test-e2e.sh | 3 ++- pkg/kapp/cmd/kapp.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hack/test-e2e.sh b/hack/test-e2e.sh index b0eb7827d..8efac8612 100755 --- a/hack/test-e2e.sh +++ b/hack/test-e2e.sh @@ -5,7 +5,8 @@ set -e -x -u go clean -testcache export KAPP_BINARY_PATH="${KAPP_BINARY_PATH:-$PWD/kapp}" - +export KAPP_E2E_NAMESPACE="kapp-test" +kubectl create ns $KAPP_E2E_NAMESPACE go test ./test/e2e/ -timeout 60m -test.v $@ echo E2E SUCCESS diff --git a/pkg/kapp/cmd/kapp.go b/pkg/kapp/cmd/kapp.go index 409b4de88..9ef8354ec 100644 --- a/pkg/kapp/cmd/kapp.go +++ b/pkg/kapp/cmd/kapp.go @@ -140,12 +140,14 @@ func NewKappCmd(o *KappOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Comman // Last one runs first cobrautil.VisitCommands(cmd, finishDebugLog, cobrautil.ReconfigureCmdWithSubcmd, - cobrautil.ReconfigureLeafCmds(cobrautil.DisallowExtraArgs), configureGlobal, cobrautil.WrapRunEForCmd(cobrautil.ResolveFlagsForCmd)) + cobrautil.ReconfigureLeafCmds(cobrautil.DisallowExtraArgs), cobrautil.WrapRunEForCmd(cobrautil.ResolveFlagsForCmd)) // Completion command have to be added after the VisitCommands // This due to the ReconfigureLeafCmds that we do not want to have enforced for the completion // This configurations forces all nodes to do not accept extra args, but the completion requires 1 extra arg cmd.AddCommand(NewCmdCompletion()) + + cobrautil.VisitCommands(cmd, configureGlobal) return cmd } From 10474439207bd37c462a84cab910d80a2dc6ca41 Mon Sep 17 00:00:00 2001 From: rohitagg2020 Date: Mon, 21 Mar 2022 16:03:12 +0530 Subject: [PATCH 2/4] Update test-e2e.sh --- hack/test-e2e.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hack/test-e2e.sh b/hack/test-e2e.sh index 8efac8612..b0eb7827d 100755 --- a/hack/test-e2e.sh +++ b/hack/test-e2e.sh @@ -5,8 +5,7 @@ set -e -x -u go clean -testcache export KAPP_BINARY_PATH="${KAPP_BINARY_PATH:-$PWD/kapp}" -export KAPP_E2E_NAMESPACE="kapp-test" -kubectl create ns $KAPP_E2E_NAMESPACE + go test ./test/e2e/ -timeout 60m -test.v $@ echo E2E SUCCESS From 09fdc7e78046f37b8e66884108e4c3ebf7dd5b0c Mon Sep 17 00:00:00 2001 From: rohitagg2020 Date: Tue, 22 Mar 2022 10:53:09 +0530 Subject: [PATCH 3/4] Update kapp.go --- pkg/kapp/cmd/kapp.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/kapp/cmd/kapp.go b/pkg/kapp/cmd/kapp.go index 9ef8354ec..797a143ce 100644 --- a/pkg/kapp/cmd/kapp.go +++ b/pkg/kapp/cmd/kapp.go @@ -138,16 +138,16 @@ func NewKappCmd(o *KappOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Comman return nil }) - // Last one runs first - cobrautil.VisitCommands(cmd, finishDebugLog, cobrautil.ReconfigureCmdWithSubcmd, - cobrautil.ReconfigureLeafCmds(cobrautil.DisallowExtraArgs), cobrautil.WrapRunEForCmd(cobrautil.ResolveFlagsForCmd)) + cobrautil.VisitCommands(cmd, cobrautil.ReconfigureLeafCmds(cobrautil.DisallowExtraArgs)) - // Completion command have to be added after the VisitCommands + // Completion command have to be added after the cobrautil.DisallowExtraArgs. // This due to the ReconfigureLeafCmds that we do not want to have enforced for the completion // This configurations forces all nodes to do not accept extra args, but the completion requires 1 extra arg cmd.AddCommand(NewCmdCompletion()) - cobrautil.VisitCommands(cmd, configureGlobal) + // Last one runs first + cobrautil.VisitCommands(cmd, finishDebugLog, cobrautil.ReconfigureCmdWithSubcmd, configureGlobal, cobrautil.WrapRunEForCmd(cobrautil.ResolveFlagsForCmd)) + return cmd } From 5afaf024921261bb6b1c2b4b40a93e9f62a20da8 Mon Sep 17 00:00:00 2001 From: rohitagg2020 Date: Tue, 22 Mar 2022 10:55:50 +0530 Subject: [PATCH 4/4] Update kapp.go --- pkg/kapp/cmd/kapp.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/kapp/cmd/kapp.go b/pkg/kapp/cmd/kapp.go index 797a143ce..803a55dce 100644 --- a/pkg/kapp/cmd/kapp.go +++ b/pkg/kapp/cmd/kapp.go @@ -147,7 +147,6 @@ func NewKappCmd(o *KappOptions, flagsFactory cmdcore.FlagsFactory) *cobra.Comman // Last one runs first cobrautil.VisitCommands(cmd, finishDebugLog, cobrautil.ReconfigureCmdWithSubcmd, configureGlobal, cobrautil.WrapRunEForCmd(cobrautil.ResolveFlagsForCmd)) - return cmd }