mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-22 10:24:35 +02:00
fix: --state-values-set unable to set booleans (#1199)
This pr fixes auto-wrapping of booleans and integers into quotes when using --state-values-set by: - Adding: --state-values-set-string flag for intentional string set of boolean or integer - Changing: --state-values-set flag not wrapping now - Removing - Resolves https://github.com/roboll/helmfile/issues/1347 Signed-off-by: Tunahan Sezen <sezentunahan@outlook.com>
This commit is contained in:
+17
-2
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func NewCLIConfigImpl(g *GlobalImpl) error {
|
||||
optsSet := g.RawStateValuesSet()
|
||||
optsSet := g.RawStateValuesSetString()
|
||||
if len(optsSet) > 0 {
|
||||
set := map[string]any{}
|
||||
for i := range optsSet {
|
||||
@@ -17,7 +17,22 @@ func NewCLIConfigImpl(g *GlobalImpl) error {
|
||||
k := maputil.ParseKey(op[0])
|
||||
v := op[1]
|
||||
|
||||
maputil.Set(set, k, v)
|
||||
maputil.Set(set, k, v, true)
|
||||
}
|
||||
}
|
||||
g.SetSet(set)
|
||||
}
|
||||
optsSet = g.RawStateValuesSet()
|
||||
if len(optsSet) > 0 {
|
||||
set := map[string]any{}
|
||||
for i := range optsSet {
|
||||
ops := strings.Split(optsSet[i], ",")
|
||||
for j := range ops {
|
||||
op := strings.SplitN(ops[j], "=", 2)
|
||||
k := maputil.ParseKey(op[0])
|
||||
v := op[1]
|
||||
|
||||
maputil.Set(set, k, v, false)
|
||||
}
|
||||
}
|
||||
g.SetSet(set)
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/term"
|
||||
|
||||
"github.com/helmfile/helmfile/pkg/maputil"
|
||||
"github.com/helmfile/helmfile/pkg/state"
|
||||
)
|
||||
|
||||
@@ -23,6 +24,8 @@ type GlobalOptions struct {
|
||||
Environment string
|
||||
// StateValuesSet is a list of state values to set on the command line.
|
||||
StateValuesSet []string
|
||||
// StateValuesSetString is a list of state values to set on the command line.
|
||||
StateValuesSetString []string
|
||||
// StateValuesFiles is a list of state values files to use.
|
||||
StateValuesFile []string
|
||||
// SkipDeps is true if the running "helm repo update" and "helm dependency build" should be skipped
|
||||
@@ -87,7 +90,7 @@ func NewGlobalImpl(opts *GlobalOptions) *GlobalImpl {
|
||||
|
||||
// Setset sets the set
|
||||
func (g *GlobalImpl) SetSet(set map[string]any) {
|
||||
g.set = set
|
||||
g.set = maputil.MergeMaps(g.set, set)
|
||||
}
|
||||
|
||||
// HelmBinary returns the path to the Helm binary.
|
||||
@@ -135,6 +138,11 @@ func (g *GlobalImpl) RawStateValuesSet() []string {
|
||||
return g.GlobalOptions.StateValuesSet
|
||||
}
|
||||
|
||||
// RawStateValuesSetString returns the set
|
||||
func (g *GlobalImpl) RawStateValuesSetString() []string {
|
||||
return g.GlobalOptions.StateValuesSetString
|
||||
}
|
||||
|
||||
// StateValuesFiles returns the state values files
|
||||
func (g *GlobalImpl) StateValuesFiles() []string {
|
||||
return g.GlobalOptions.StateValuesFile
|
||||
|
||||
Reference in New Issue
Block a user