Skip to content

fix(robot_delete): adapt robot api handler for deletion by name; adapt robot delete commands for project and system to allow for deletion by name#563

Merged
bupd merged 6 commits into
goharbor:mainfrom
qcserestipy:555_fix_delete_robot_by_name
Nov 25, 2025
Merged

fix(robot_delete): adapt robot api handler for deletion by name; adapt robot delete commands for project and system to allow for deletion by name#563
bupd merged 6 commits into
goharbor:mainfrom
qcserestipy:555_fix_delete_robot_by_name

Conversation

@qcserestipy

@qcserestipy qcserestipy commented Oct 22, 2025

Copy link
Copy Markdown
Collaborator

Closes #555

Overview

This PR introduces changes to improve user experience for project and system robot deletion. It introduces the possibility to delete both kinds of robots by name instead of ID.

Behavior

Screen.Recording.2025-10-28.at.20.19.18.mov

…t robot delete commands for project and system to allow for deletion by name

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
@Vad1mo Vad1mo requested a review from Copilot October 22, 2025 06:52

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

This PR enables robot account deletion by name instead of ID for both project and system robots. The change improves usability by allowing users to reference robots using human-readable names rather than numeric IDs.

Key Changes:

  • Added GetRobotByName function to resolve robot names to IDs
  • Updated deletion commands to accept robot names as arguments
  • Updated all documentation to reflect the name-based deletion approach

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/api/robot_handler.go Adds new GetRobotByName function to retrieve robot by name; removes trailing whitespace
cmd/harbor/root/robot/delete.go Updates system robot delete command to accept names instead of IDs
cmd/harbor/root/project/robot/delete.go Updates project robot delete command to accept names instead of IDs
doc/man-docs/man1/harbor-robot-delete.1 Updates man page documentation to reflect name-based deletion
doc/man-docs/man1/harbor-project-robot-delete.1 Updates project robot man page for name-based deletion
doc/cli-docs/harbor-robot.md Updates CLI reference for robot commands
doc/cli-docs/harbor-robot-delete.md Updates robot delete command documentation
doc/cli-docs/harbor-project-robot.md Updates project robot command reference
doc/cli-docs/harbor-project-robot-delete.md Updates project robot delete documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/api/robot_handler.go Outdated
Comment thread cmd/harbor/root/project/robot/delete.go Outdated
…se robot is not found by name

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
@qcserestipy qcserestipy requested review from Vad1mo and Copilot October 23, 2025 09:59

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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/api/robot_handler.go Outdated
Comment thread pkg/api/robot_handler.go Outdated
@codecov

codecov Bot commented Oct 23, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.58%. Comparing base (60ad0bd) to head (c0a25b8).
⚠️ Report is 61 commits behind head on main.

Files with missing lines Patch % Lines
pkg/api/robot_handler.go 0.00% 34 Missing ⚠️
cmd/harbor/root/project/robot/delete.go 0.00% 20 Missing ⚠️
cmd/harbor/root/robot/delete.go 0.00% 12 Missing ⚠️
cmd/harbor/root/project/robot/create.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #563      +/-   ##
=========================================
- Coverage   10.99%   6.58%   -4.41%     
=========================================
  Files         173     258      +85     
  Lines        8671   12566    +3895     
=========================================
- Hits          953     828     -125     
- Misses       7612   11632    +4020     
  Partials      106     106              

☔ 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.

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
@Vad1mo

Vad1mo commented Oct 28, 2025

Copy link
Copy Markdown
Member

We should lookup the robot accounts with get and query:

image

…g in robot delete commands; handle robot names with and without prefix for deletion

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
@qcserestipy

Copy link
Copy Markdown
Collaborator Author

As discussed in our weekly meeting today I have implemented the name search query for the robot list command to search robots by name and delete them. Please feel free to review this. @Vad1mo @bupd

@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.

@qcserestipy Thanks for your contribution

Added my suggestions for possible edge cases and improvements.

Comment thread pkg/api/robot_handler.go
Comment thread pkg/api/robot_handler.go Outdated
… accept returned robot object

Signed-off-by: Patrick Eschenbach <patrickeschenbach96@gmail.com>
@qcserestipy

Copy link
Copy Markdown
Collaborator Author

@bupd Thank you for your review! I incorporated the changes accordingly. In case you have time feel free to have another look.

@bupd bupd added the enhancement New feature or request label Nov 25, 2025

@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 1070ff6 into goharbor:main Nov 25, 2025
7 of 9 checks passed
@bupd bupd mentioned this pull request Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ID column in robot list table not present

4 participants