Skip to content

Commit

Permalink
feat: allow being invoked as helm2 or helm3 in addition to helm
Browse files Browse the repository at this point in the history
In transparent wrapping mode, Helm Sops binary could be named 'helm', the Helm binary being renamed to '_helm'. This didn't allow coinstalling Helm 2 and Helm 3. Helm Sops binary can now have a link named helm2 (or helm3) pointing to it to transparently wrap Helm 2 and Helm 3, the Helm 2 binary being renamed to '_helm2' (or the Helm 3 binary being renamed to '_helm3').
  • Loading branch information
yann-soubeyrand committed Apr 3, 2020
1 parent 729c975 commit 86f0c26
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ func runHelm() (errs []error) {
var helmPath string
var err error

if path.Base(os.Args[0]) == "helm" {
helmPath, err = exec.LookPath("_helm")
switch executableName := path.Base(os.Args[0]); executableName {
case "helm", "helm2", "helm3":
executableName = fmt.Sprintf("_%s", executableName)

helmPath, err = exec.LookPath(executableName)

if err != nil {
return append(errs, fmt.Errorf("failed to find Helm binary '_helm'"))
return append(errs, fmt.Errorf("failed to find Helm binary '%s'", executableName))
}
} else {
default:
helmPath, err = exec.LookPath("helm")

if err != nil {
Expand Down

0 comments on commit 86f0c26

Please sign in to comment.