feat : instance remaining subcommands#812
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #812 +/- ##
=========================================
- Coverage 10.99% 8.76% -2.23%
=========================================
Files 173 277 +104
Lines 8671 13812 +5141
=========================================
+ Hits 953 1211 +258
- Misses 7612 12486 +4874
- Partials 106 115 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a9b9d73 to
9c6c75e
Compare
There was a problem hiding this comment.
Pull request overview
Adds the remaining instance subcommands (view, update, ping) to support managing preheat provider instances end-to-end from the Harbor CLI, and updates the create flow/docs to better support auth modes + credentials.
Changes:
- Added new
harbor instance view|update|pingcommands (including interactive update/view UI). - Extended the API layer with
GetInstance,UpdateInstance, andPingInstance, and adjusted instance listing helper usage. - Updated prompt + CLI/man docs to include the new subcommands and updated create flags.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/harbor/root/instance/cmd.go |
Registers the new instance subcommands. |
cmd/harbor/root/instance/view.go |
Implements instance view command flow (arg/prompt + output formatting). |
cmd/harbor/root/instance/update.go |
Implements instance update (flags vs interactive form) and calls update API. |
cmd/harbor/root/instance/ping.go |
Implements instance ping command flow (arg/prompt + optional formatted output). |
cmd/harbor/root/instance/create.go |
Enhances instance create auth handling + success messaging + flag set changes. |
cmd/harbor/root/instance/delete.go |
Updates delete to use the new prompt function signature. |
cmd/harbor/root/instance/list.go |
Switches to ListAllInstance API helper. |
pkg/api/instance_handler.go |
Adds GetInstance, UpdateInstance, PingInstance, and renames list helper to ListAllInstance. |
pkg/prompt/prompt.go |
Adds GetInstanceNameFromUser() returning (string, error) and uses the updated list helper. |
pkg/views/instance/view/view.go |
Adds a table-based UI for viewing an instance. |
pkg/views/instance/update/view.go |
Adds interactive update form (including auth mode + credentials inputs). |
pkg/views/instance/select/view.go |
Refactors instance selection view to return (string, error) with abort semantics. |
pkg/views/instance/list/view.go |
Standardizes column widths via tablelist constants. |
pkg/views/instance/create/view.go |
Refactors create UI to return error and populates auth info based on selected auth mode. |
doc/man-docs/man1/harbor-instance.1 |
Adds SEE ALSO references to the new subcommands. |
doc/man-docs/man1/harbor-instance-{view,update,ping}.1 |
Adds man pages for the new subcommands. |
doc/man-docs/man1/harbor-instance-create.1 |
Updates create flags documentation (auth flags, wording, defaults). |
doc/cli-docs/harbor-instance.md |
Adds new subcommands to CLI docs index. |
doc/cli-docs/harbor-instance-{view,update,ping}.md |
Adds CLI docs pages for the new subcommands. |
doc/cli-docs/harbor-instance-create.md |
Updates create flags documentation (auth flags, wording, defaults). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| instanceName, err = prompt.GetInstanceNameFromUser() | ||
| if err != nil { | ||
| return fmt.Errorf("%v", err) | ||
| } |
There was a problem hiding this comment.
These fmt.Errorf("%v", err) returns discard the original error type and stack/context, making errors.Is/As impossible upstream. Prefer returning err directly or wrapping with %w and a short context message.
| p, err := tea.NewProgram(m).Run() | ||
| if err != nil { | ||
| fmt.Println("Error running program:", err) | ||
| os.Exit(1) | ||
| } |
There was a problem hiding this comment.
InstanceList now returns an error, but on Bubble Tea program failure it still prints to stdout and calls os.Exit(1), which makes the error path untestable and prevents callers (e.g. prompts) from handling the failure. Return the error instead of exiting the process.
| if model.Aborted { | ||
| return "", ErrUserAborted | ||
| } | ||
| if model.Choice == "" { | ||
| return "", errors.New("no instance selected") | ||
| } |
There was a problem hiding this comment.
ErrUserAborted/model.Aborted handling appears to be dead code: the shared selection.Model never sets Aborted, so this function will never return ErrUserAborted and callers won't be able to distinguish a user cancel/quit from other failures. Either implement abort detection (e.g. set Aborted on esc/q/ctrl+c in the selection model) or treat an empty Choice as an abort and return ErrUserAborted consistently.
| if model.Aborted { | |
| return "", ErrUserAborted | |
| } | |
| if model.Choice == "" { | |
| return "", errors.New("no instance selected") | |
| } | |
| if model.Aborted || model.Choice == "" { | |
| return "", ErrUserAborted | |
| } |
qcserestipy
left a comment
There was a problem hiding this comment.
Thank you for your contribution, in principle LGTM! I attached only minor comments, and please add more docs to the commands.
qcserestipy
left a comment
There was a problem hiding this comment.
Thank you for your changes! LGTM
a06ce62 to
c320243
Compare
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
… create command Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
c320243 to
948eb08
Compare
Description
Adds missing
instancecommand support for preheat provider workflows.Commands
instance view: command to view details of a preheat instance.instance update: command to update a preheat instance (flags + interactive form).instance ping: command to ping health of a preheat instance.Type of Change
Please select the relevant type.
Changes
instance viewcommand to show details of a single instance.instance updatecommand to edit existing instance configuration.instance pingcommand to check instance connectivity/health.instance create(auth mode + credentials flow).