From e1c95868dd82b6c787b16b29819d1ea43bc3a017 Mon Sep 17 00:00:00 2001 From: lazychanger Date: Fri, 21 Oct 2022 10:46:18 +0800 Subject: [PATCH] support use alias helmbin Signed-off-by: lazychanger --- Readme.md | 5 +++++ cmd/helm-variable-in-values/main.go | 9 +++++++-- plugin.yaml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 3f0a1c5..868668e 100644 --- a/Readme.md +++ b/Readme.md @@ -85,4 +85,9 @@ $ tree ./example/simple-example # ├── autoscaling.yaml # └── values.yaml ``` +## Config +### Env +| name | default | desc | +|------------------|---------|-----------------------------------------| +| HELM_VIV_HELMBIN | helm | use helmbin when viv proxy helm command | diff --git a/cmd/helm-variable-in-values/main.go b/cmd/helm-variable-in-values/main.go index 1324add..8ea5c18 100644 --- a/cmd/helm-variable-in-values/main.go +++ b/cmd/helm-variable-in-values/main.go @@ -46,6 +46,7 @@ Examples: cliFlags = new(utils.Flags) actionConfig = new(action.Configuration) version = common.GetVersion() + helmbin = "helm" ) func init() { @@ -68,6 +69,10 @@ func init() { settings.BurstLimit = utils.IntDefaultValue(cliFlags.GetInt("burst-limit"), settings.BurstLimit) settings.RepositoryConfig = utils.StringDefaultValue(cliFlags.GetString("repository-config"), settings.RepositoryConfig) + _helmbin := os.Getenv("HELM_VIV_HELMBIN") + if _helmbin != "" { + helmbin = _helmbin + } } func main() { @@ -236,8 +241,8 @@ func clearFlags(args []string) []string { func proxyHelmCmd(args []string) error { - log.Printf("exec: helm %s", strings.Join(args, " ")) - cmd := exec.Command("helm", args...) + log.Printf("exec: %s %s", helmbin, strings.Join(args, " ")) + cmd := exec.Command(helmbin, args...) cmd.Env = os.Environ() cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr diff --git a/plugin.yaml b/plugin.yaml index 7bcd5c1..9972d5c 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: "viv" -version: "0.2.2" +version: "0.2.3" usage: "get the last release name" command: "$HELM_PLUGIN_DIR/bin/helm-viv" description: "get the last release name"