-
Notifications
You must be signed in to change notification settings - Fork 318
fix(version): print out version regardless of port-forwarding; pass through contexts #980
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the version command to print the kagent CLI version regardless of whether port-forwarding to the kagent server succeeds. The changes ensure version information is always displayed, with remote versions reported as "unknown" when unavailable.
- Modified version command to use
deferfor version printing, ensuring it always executes - Updated all port-forwarding operations to use
cmd.Context()instead of a global context variable - Added a help target to the Makefile
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| go/cli/cmd/kagent/main.go | Fixed version command to always print version info and updated context usage throughout CLI commands |
| go/Makefile | Added default help target for listing makefile targets |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
6d9b95f to
3a235d4
Compare
3a235d4 to
f9afc7c
Compare
Signed-off-by: Tom Morelly <[email protected]>
f9afc7c to
67b9e25
Compare
…hrough contexts (kagent-dev#980) This PR prints out the `kagent` version even if a port-forwarding to the `kagent` server fails. In case the port-forwarding does not succeed, the unavailable versions will be marked as `<unknown>`: Fixes: kagent-dev#868 Related to: kagent-dev#879 ```sh > go run cli/cmd/kagent/main.go version Error starting port-forward: failed to establish connection to kagent-controller. error connecting to server. Please run 'install' command first {"backend_version":"unknown","build_date":"unknown","git_commit":"none","kagent_version":"dev"} ``` ~~**Note:** We might can consider removing the error message as it breaks the `json` output ...~~ Furthermore: - This PR uses `cmd.Context()` consistently throughout all `kagent` subcommands. - It adds a `help` Makefile target for a neat list of available Makefile targets ```sh > make controller-gen Download controller-gen locally if necessary. envtest Download setup-envtest locally if necessary. fmt Run go fmt against code. generate Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. golangci-lint Download golangci-lint locally if necessary. help list makefile targets lint-config Verify golangci-lint linter configuration lint-fix Run golangci-lint linter and perform fixes lint Run golangci-lint linter manifests Generate ClusterRole and CustomResourceDefinition objects. run Run a controller from your host. setup-envtest Download the binaries required for ENVTEST in the local bin directory. vet Run go vet against code. ``` Signed-off-by: Tom Morelly <[email protected]>
…hrough contexts (kagent-dev#980) This PR prints out the `kagent` version even if a port-forwarding to the `kagent` server fails. In case the port-forwarding does not succeed, the unavailable versions will be marked as `<unknown>`: Fixes: kagent-dev#868 Related to: kagent-dev#879 ```sh > go run cli/cmd/kagent/main.go version Error starting port-forward: failed to establish connection to kagent-controller. error connecting to server. Please run 'install' command first {"backend_version":"unknown","build_date":"unknown","git_commit":"none","kagent_version":"dev"} ``` ~~**Note:** We might can consider removing the error message as it breaks the `json` output ...~~ Furthermore: - This PR uses `cmd.Context()` consistently throughout all `kagent` subcommands. - It adds a `help` Makefile target for a neat list of available Makefile targets ```sh > make controller-gen Download controller-gen locally if necessary. envtest Download setup-envtest locally if necessary. fmt Run go fmt against code. generate Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. golangci-lint Download golangci-lint locally if necessary. help list makefile targets lint-config Verify golangci-lint linter configuration lint-fix Run golangci-lint linter and perform fixes lint Run golangci-lint linter manifests Generate ClusterRole and CustomResourceDefinition objects. run Run a controller from your host. setup-envtest Download the binaries required for ENVTEST in the local bin directory. vet Run go vet against code. ``` Signed-off-by: Tom Morelly <[email protected]>
|
cheers for this one @FalcoSuessgott I'm getting on mac m4, not sure if expected |
This PR prints out the
kagentversion even if a port-forwarding to thekagentserver fails. In case the port-forwarding does not succeed, the unavailable versions will be marked as<unknown>:Fixes: #868
Related to: #879
Note: We might can consider removing the error message as it breaks thejsonoutput ...Furthermore:
cmd.Context()consistently throughout allkagentsubcommands.helpMakefile target for a neat list of available Makefile targets