Skip to content
Permalink
Browse files
fix(bundles): --secret-values option for bundle-render command
+ Fix panic when null-value in secret-values.yaml exist.

Refs #4600

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Jul 13, 2022
1 parent 28ee542 commit f722ec99d6594700e85b6d91acc4cb91030aed04
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
@@ -21,6 +21,7 @@ import (
"github.com/werf/werf/pkg/deploy/helm/chart_extender"
"github.com/werf/werf/pkg/deploy/helm/chart_extender/helpers"
"github.com/werf/werf/pkg/deploy/helm/command_helpers"
"github.com/werf/werf/pkg/deploy/secrets_manager"
"github.com/werf/werf/pkg/storage"
"github.com/werf/werf/pkg/util"
"github.com/werf/werf/pkg/werf"
@@ -85,6 +86,8 @@ func NewCmd(ctx context.Context) *cobra.Command {
common.SetupSetString(&commonCmdData, cmd)
common.SetupSetFile(&commonCmdData, cmd)
common.SetupValues(&commonCmdData, cmd)
common.SetupSecretValues(&commonCmdData, cmd)
common.SetupIgnoreSecretKey(&commonCmdData, cmd)

common.SetupRelease(&commonCmdData, cmd)
common.SetupNamespace(&commonCmdData, cmd)
@@ -184,7 +187,10 @@ func runRender(ctx context.Context) error {
userExtraAnnotations["project.werf.io/env"] = *commonCmdData.Environment
}

bundle, err := chart_extender.NewBundle(ctx, bundleDir, helm_v3.Settings, helmRegistryClientHandle, nil, chart_extender.BundleOptions{
secretsManager := secrets_manager.NewSecretsManager(secrets_manager.SecretsManagerOptions{DisableSecretsDecryption: *commonCmdData.IgnoreSecretKey})

bundle, err := chart_extender.NewBundle(ctx, bundleDir, helm_v3.Settings, helmRegistryClientHandle, secretsManager, chart_extender.BundleOptions{
SecretValueFiles: common.GetSecretValues(&commonCmdData),
BuildChartDependenciesOpts: command_helpers.BuildChartDependenciesOptions{IgnoreInvalidAnnotationsAndLabels: false},
IgnoreInvalidAnnotationsAndLabels: false,
ExtraAnnotations: userExtraAnnotations,
@@ -15,7 +15,12 @@ func ExtractSecretValuesFromMap(data map[string]interface{}) []string {
var elemI interface{}
elemI, queue = queue[0], queue[1:]

switch reflect.TypeOf(elemI).Kind() {
elemType := reflect.TypeOf(elemI)
if elemType == nil {
continue
}

switch elemType.Kind() {
case reflect.Slice, reflect.Array:
elem := reflect.ValueOf(elemI)
for i := 0; i < elem.Len(); i++ {

0 comments on commit f722ec9

Please sign in to comment.