-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
What broke? What's expected?
When running kubebuilder alpha generate
, the generate-subcommand is directly invoking the kubebuilder
binary in the current working directory.
This might lead to a failed execution in two different ways:
- your
kubebuilder
binary is not inPATH
and you want to run the binary from somewhere else
$ /tmp/kubebuilder alpha generate
Error: kubebuilder not found in the path: exec: "kubebuilder": executable file not found in $PATH
Usage:
kubebuilder alpha generate [flags]
Flags:
-h, --help help for generate
--input-dir string Specifies the full path to a Kubebuilder project file. If not provided, the current working directory is used.
--output-dir string Specifies the full path where the scaffolded files will be output. Defaults to a directory within the current working directory.
Global Flags:
--plugins strings plugin keys to be used for this subcommand execution
FATA error executing command: kubebuilder not found in the path: exec: "kubebuilder": executable file not found in $PATH
- the version of
kubebuilder
inPATH
is an older one wherekubebuilder alpha generate
is getting called (where e.g. not all plugins already exist - e.g. the newly introduced helm plugin)
Within alpha generate
there is a check to verify if kubebuilder
is in PATH:
exec.LookPath
func from
_, err = exec.LookPath("kubebuilder") |
and than kubebuilder
is getting called via RunCmd("kubebuilder
:
https://github.com/search?q=repo%3Akubernetes-sigs%2Fkubebuilder+util.RunCmd%28%22kubebuilder+path%3Apkg%2Fcli%2Falpha%2Finternal%2F*&type=code
additional notes:
at least for Linux it could get solved by using the value of the _
environment variable (e.g.: os.Getenv("_")
)
Reproducing this issue
- ensure
kubebuilder
is not in yourPATH
- move
kubebuilder
binary to e.g./tmp
- change your working dir to an existing
kubebuilder
generated directory - run
/tmp/kubebuilder alpha generate
KubeBuilder (CLI) Version
4.6.0
PROJECT version
3
Plugin versions
Other versions
No response
Extra Labels
No response
vitorfloriano
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.