goharbor / goharbor/harbor-cli
[bug]: Errors not propagated in tag retention rule deletion flow
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
### Description
The `tag retention delete` command lacks error handling when retrieving and selecting the tag retention rules. Additionally, `api.DeleteRetention()` performs redundant network queries to resolve project names to retention IDs.
### Environment
- Version: Harbor CLI latest main branch
- OS: Windows / macOS / Linux
### Steps To Reproduce
1. Log in to a dummy Harbor server address (which fails connection) using `harbor login --skip-verify-client`.
2. Run the command: `harbor tag retention delete --project `.
3. Select the retention rule from the prompt or observe the behavior when the API server is unreachable.
### Expected Behavior
- The CLI should surface a clear network connection error or selection cancellation error to the user and exit with code `1`.
- The API helper should utilize direct retention IDs when already available to save network lookups.
### Actual Behavior
- The CLI exits unexpectedly, blocks, or fails to surface the underlying network/connection error to the user when the rule retrieval fails.
- The `DeleteRetention` client helper makes a redundant network call to `GetRetentionId` even when the retention ID is already resolved by the caller.
### Evidence
```powershell
PS C:\Users\govin\OneDrive\Documents\opensrc\harbor-cli> .\harbor.exe tag retention delete --project test-project
# Silent exit (exits with code 1, but prints no errors to stdout or stderr)
```
Contributor guide
Assessment
This issue has not been assessed yet.