Skip to content

feat : instance remaining subcommands#812

Merged
bupd merged 9 commits into
goharbor:mainfrom
Sypher845:feat/instance-view-update-ping
May 7, 2026
Merged

feat : instance remaining subcommands#812
bupd merged 9 commits into
goharbor:mainfrom
Sypher845:feat/instance-view-update-ping

Conversation

@Sypher845

Copy link
Copy Markdown
Contributor

Description

Adds missing instance command support for preheat provider workflows.

Commands

  • instance view : command to view details of a preheat instance.
Kooha-2026-04-16-03-32-29
  • instance update : command to update a preheat instance (flags + interactive form).
Kooha-2026-04-16-03-34-25
  • instance ping : command to ping health of a preheat instance.
Kooha-2026-04-16-03-36-54

Type of Change

Please select the relevant type.

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Added instance view command to show details of a single instance.
  • Added instance update command to edit existing instance configuration.
  • Added instance ping command to check instance connectivity/health.
  • Improved auth handling in instance create (auth mode + credentials flow).

@Sypher845 Sypher845 changed the title Feat/instance view update ping feat : instance remaining subcommands Apr 15, 2026
@codecov

codecov Bot commented Apr 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 423 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.76%. Comparing base (60ad0bd) to head (948eb08).
⚠️ Report is 148 commits behind head on main.

Files with missing lines Patch % Lines
cmd/harbor/root/instance/update.go 0.00% 106 Missing ⚠️
pkg/views/instance/update/view.go 0.00% 70 Missing ⚠️
pkg/api/instance_handler.go 0.00% 47 Missing ⚠️
cmd/harbor/root/instance/create.go 0.00% 42 Missing ⚠️
cmd/harbor/root/instance/view.go 0.00% 42 Missing ⚠️
cmd/harbor/root/instance/ping.go 0.00% 40 Missing ⚠️
pkg/prompt/prompt.go 0.00% 22 Missing ⚠️
pkg/views/instance/view/view.go 0.00% 19 Missing ⚠️
pkg/views/instance/create/view.go 0.00% 15 Missing ⚠️
pkg/views/instance/select/view.go 0.00% 13 Missing ⚠️
... and 3 more
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@qcserestipy qcserestipy self-requested a review April 19, 2026 08:51
@Sypher845 Sypher845 force-pushed the feat/instance-view-update-ping branch from a9b9d73 to 9c6c75e Compare April 23, 2026 21:18
@qcserestipy qcserestipy requested a review from Copilot April 27, 2026 10:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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|ping commands (including interactive update/view UI).
  • Extended the API layer with GetInstance, UpdateInstance, and PingInstance, 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.

Comment thread cmd/harbor/root/instance/create.go Outdated
Comment thread doc/cli-docs/harbor-instance-create.md Outdated
Comment thread doc/man-docs/man1/harbor-instance-create.1
Comment on lines +46 to +49
instanceName, err = prompt.GetInstanceNameFromUser()
if err != nil {
return fmt.Errorf("%v", err)
}

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread cmd/harbor/root/instance/view.go
Comment on lines +37 to 41
p, err := tea.NewProgram(m).Run()
if err != nil {
fmt.Println("Error running program:", err)
os.Exit(1)
}

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +49
if model.Aborted {
return "", ErrUserAborted
}
if model.Choice == "" {
return "", errors.New("no instance selected")
}

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
if model.Aborted {
return "", ErrUserAborted
}
if model.Choice == "" {
return "", errors.New("no instance selected")
}
if model.Aborted || model.Choice == "" {
return "", ErrUserAborted
}

Copilot uses AI. Check for mistakes.
Comment thread cmd/harbor/root/instance/create.go

@qcserestipy qcserestipy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, in principle LGTM! I attached only minor comments, and please add more docs to the commands.

Comment thread cmd/harbor/root/instance/ping.go
Comment thread cmd/harbor/root/instance/update.go Outdated
Comment thread cmd/harbor/root/instance/update.go
Comment thread pkg/views/instance/update/view.go
Comment thread cmd/harbor/root/instance/view.go
Comment thread pkg/views/instance/update/view.go
@qcserestipy qcserestipy added enhancement New feature or request Changes Requesed feedback that must be addressed before merging. labels Apr 27, 2026

@qcserestipy qcserestipy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your changes! LGTM

@Sypher845 Sypher845 force-pushed the feat/instance-view-update-ping branch from a06ce62 to c320243 Compare May 5, 2026 06:05
Sypher845 added 9 commits May 5, 2026 18:46
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>
@Sypher845 Sypher845 force-pushed the feat/instance-view-update-ping branch from c320243 to 948eb08 Compare May 5, 2026 13:16
@bupd bupd self-requested a review May 6, 2026 06:40

@bupd bupd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@bupd bupd merged commit 0dd15d5 into goharbor:main May 7, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes Requesed feedback that must be addressed before merging. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature]: Add missing instance subcommands

4 participants