From bafcb8f4d6bda4c5a6522d9a834cf9944fdad9d5 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 27 Feb 2020 06:38:58 +0000 Subject: [PATCH] fix: lets add a conditional compilation flag so that we can reuse the same code in jx alpha / jx 3.x where we default to helm 3 Signed-off-by: James Strachan --- pkg/cmd/opts/common.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/opts/common.go b/pkg/cmd/opts/common.go index 428bda6492..b2a14d9cf4 100644 --- a/pkg/cmd/opts/common.go +++ b/pkg/cmd/opts/common.go @@ -99,6 +99,10 @@ var ( QuickStartLocationCommandAliases = []string{ QuickStartLocationCommandName + "s", "quickstartloc", "qsloc", } + + // UseHelm3 a conditional compilation flag which is false for jx 2.x builds but for alpha / 3.x builds + // is true to default to only using helm 3 + UseHelm3 = false ) // ModifyDevEnvironmentFn a callback to create/update the development Environment @@ -208,12 +212,16 @@ func (o *CommonOptions) NotifyProgress(level LogLevel, format string, args ...in // NewCommonOptionsWithTerm creates a new CommonOptions instance with given terminal input, output and error func NewCommonOptionsWithTerm(factory clients.Factory, in terminal.FileReader, out terminal.FileWriter, err io.Writer) *CommonOptions { - return &CommonOptions{ + co := &CommonOptions{ factory: factory, In: in, Out: out, Err: err, } + if UseHelm3 { + co.SetHelm(helm.NewHelmCLI("helm", helm.V3, "", false)) + } + return co } // NewCommonOptionsWithFactory creates a new CommonOptions instance with the