From 4983470d9be6fbc3a759a1a418ec1475a0e936d8 Mon Sep 17 00:00:00 2001 From: zbenhadi Date: Tue, 28 Feb 2023 10:32:50 +0100 Subject: [PATCH 1/2] task: Print filled pipeline values on validate & process --- cmd/config.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index 40344a079..e45ea86f9 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -138,15 +138,17 @@ func validateConfig(opts configOptions, flags *pflag.FlagSet) error { } //if no orgId provided use org slug + values := pipeline.LocalPipelineValues() + fmt.Println("Validating config with following values :\n", values) orgID, _ := flags.GetString("org-id") if strings.TrimSpace(orgID) != "" { - response, err = api.ConfigQuery(opts.cl, path, orgID, nil, pipeline.LocalPipelineValues()) + response, err = api.ConfigQuery(opts.cl, path, orgID, nil, values) if err != nil { return err } } else { orgSlug, _ := flags.GetString("org-slug") - response, err = api.ConfigQueryLegacy(opts.cl, path, orgSlug, nil, pipeline.LocalPipelineValues()) + response, err = api.ConfigQueryLegacy(opts.cl, path, orgSlug, nil, values) if err != nil { return err } @@ -192,15 +194,17 @@ func processConfig(opts configOptions, flags *pflag.FlagSet) error { } //if no orgId provided use org slug + values := pipeline.LocalPipelineValues() + fmt.Println("Processing config with following values: \n", values) orgID, _ := flags.GetString("org-id") if strings.TrimSpace(orgID) != "" { - response, err = api.ConfigQuery(opts.cl, opts.args[0], orgID, params, pipeline.LocalPipelineValues()) + response, err = api.ConfigQuery(opts.cl, opts.args[0], orgID, params, values) if err != nil { return err } } else { orgSlug, _ := flags.GetString("org-slug") - response, err = api.ConfigQueryLegacy(opts.cl, opts.args[0], orgSlug, params, pipeline.LocalPipelineValues()) + response, err = api.ConfigQueryLegacy(opts.cl, opts.args[0], orgSlug, params, values) if err != nil { return err } From be54c9696b427d39a7de1bafcbbefe40c21043fe Mon Sep 17 00:00:00 2001 From: zbenhadi Date: Tue, 28 Feb 2023 15:14:21 +0100 Subject: [PATCH 2/2] task: Print filled pipeline values on validate & process --- cmd/config.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/config.go b/cmd/config.go index e45ea86f9..5ae76fcde 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -139,7 +139,9 @@ func validateConfig(opts configOptions, flags *pflag.FlagSet) error { //if no orgId provided use org slug values := pipeline.LocalPipelineValues() - fmt.Println("Validating config with following values :\n", values) + fmt.Println("Validating config with following values") + printValues(values) + orgID, _ := flags.GetString("org-id") if strings.TrimSpace(orgID) != "" { response, err = api.ConfigQuery(opts.cl, path, orgID, nil, values) @@ -195,7 +197,9 @@ func processConfig(opts configOptions, flags *pflag.FlagSet) error { //if no orgId provided use org slug values := pipeline.LocalPipelineValues() - fmt.Println("Processing config with following values: \n", values) + fmt.Println("Processing config with following values") + printValues(values) + orgID, _ := flags.GetString("org-id") if strings.TrimSpace(orgID) != "" { response, err = api.ConfigQuery(opts.cl, opts.args[0], orgID, params, values) @@ -231,3 +235,9 @@ func packConfig(opts configOptions) error { func migrateConfig(opts configOptions) error { return proxy.Exec([]string{"config", "migrate"}, opts.args) } + +func printValues(values pipeline.Values) { + for key, value := range values { + fmt.Printf("\t%s:\t%s", key, value) + } +}