Files
deploy/test/fixture/path/hack_path.go
T
Alexander MatyushentsevandGitHub eabe65f476 refactor: use argocd-git-ask-pass to pass git credentials to git/kustomize (#8516)
refactor: use argocd-git-ask-pass to pass git credentials to git/kustomize  (#8516)

Signed-off-by: Alexander Matyushentsev <[email protected]>
2022-02-22 17:57:11 -08:00

28 lines
559 B
Go

package path
import (
"fmt"
"os"
"path/filepath"
"github.com/argoproj/argo-cd/v2/util/errors"
)
type AddBinDirToPath struct {
originalPath string
}
func (h AddBinDirToPath) Close() {
_ = os.Setenv("PATH", h.originalPath)
}
// add the hack path which has the argocd binary
func NewBinDirToPath() AddBinDirToPath {
originalPath := os.Getenv("PATH")
binDir, err := filepath.Abs("../../dist")
errors.CheckError(err)
err = os.Setenv("PATH", fmt.Sprintf("%s:%s", originalPath, binDir))
errors.CheckError(err)
return AddBinDirToPath{originalPath}
}