Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonnet-bundler binary env var #271

Closed
sh0rez opened this issue May 6, 2020 · 0 comments · Fixed by #272
Closed

jsonnet-bundler binary env var #271

sh0rez opened this issue May 6, 2020 · 0 comments · Fixed by #272
Labels
component/cli Command Line Interface good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sh0rez
Copy link
Member

sh0rez commented May 6, 2020

Currently we hard-code to use the binary called jb on the $PATH in init.go:

tanka/cmd/tk/init.go

Lines 74 to 76 in 6941b87

if _, err := exec.LookPath("jb"); err != nil {
return errors.New("jsonnet-bundler not found in $PATH. Follow https://tanka.dev/install#jsonnet-bundler for installation instructions")
}

To be more resilient to differently set up environments, we should allow to set an TANKA_JB_PATH, similar to the existing TANKA_KUBECTL_PATH: https://tanka.dev/env-vars#tanka_kubectl_path


Steps to implement:

  1. Use os.Getenv("TANKA_JB_PATH") to read the env var, but default to "jb" if unset, as already done for kubectl:

    binary := "kubectl"
    if env := os.Getenv("TANKA_KUBECTL_PATH"); env != "" {
    binary = env
    }

  2. Put the result of that into the exec.LookPath call, keep the error checking:

    tanka/cmd/tk/init.go

    Lines 74 to 76 in 6941b87

    if _, err := exec.LookPath("jb"); err != nil {
    return errors.New("jsonnet-bundler not found in $PATH. Follow https://tanka.dev/install#jsonnet-bundler for installation instructions")
    }

  3. Update the docs to include the new env var in docs/docs/env-vars.md.

@sh0rez sh0rez added help wanted Extra attention is needed good first issue Good for newcomers component/cli Command Line Interface labels May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cli Command Line Interface good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant