From dc5d06418cb086f56f3fafadb6c95c06ae0d0dfd Mon Sep 17 00:00:00 2001 From: Jonathan Perry Date: Wed, 17 May 2023 20:48:38 -0400 Subject: [PATCH] Ensure variables are uppercase (#1728) If there are variables in a config.json/toml and variables provided via the `--set` flag we need to ensure both the variable keys are uppercase before processing and templating them. At the moment we were only uppercasing the config file variable keys which resulted in inconsistent behavior because of the indeterministic ordering of maps as we were looking for the variable's value. Fixes #1726 --- src/cmd/package.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/package.go b/src/cmd/package.go index f94be45938..c68f28f581 100644 --- a/src/cmd/package.go +++ b/src/cmd/package.go @@ -81,8 +81,11 @@ var packageDeployCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { pkgConfig.DeployOpts.PackagePath = choosePackage(args) - // Ensure uppercase keys from viper + // Ensure uppercase keys from viper and CLI --set viperConfigSetVariables := utils.TransformMapKeys(v.GetStringMapString(V_PKG_DEPLOY_SET), strings.ToUpper) + pkgConfig.DeployOpts.SetVariables = utils.TransformMapKeys(pkgConfig.DeployOpts.SetVariables, strings.ToUpper) + + // Merge the viper config file variables and provided CLI flag variables (CLI takes precedence)) pkgConfig.DeployOpts.SetVariables = utils.MergeMap(viperConfigSetVariables, pkgConfig.DeployOpts.SetVariables) // Configure the packager