Skip to content

Commit

Permalink
Merge pull request #9 from lazychanger/hotfix/support-helm-alias
Browse files Browse the repository at this point in the history
support use alias helmbin
  • Loading branch information
lazychanger authored Oct 21, 2022
2 parents d0fe327 + e1c9586 commit 68c11f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
9 changes: 7 additions & 2 deletions cmd/helm-variable-in-values/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Examples:
cliFlags = new(utils.Flags)
actionConfig = new(action.Configuration)
version = common.GetVersion()
helmbin = "helm"
)

func init() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 68c11f1

Please sign in to comment.