fix(webhook): avoid rendering interactive table when output format is… - #1099
Open
TaichKarna wants to merge 3 commits into
Open
TaichKarna wants to merge 3 commits into
TaichKarna wants to merge 3 commits into
Conversation
… specified Signed-off-by: TaichKarna <taichikarna@gmail.com>
JituRewar
reviewed
Sep 14, 2026
JituRewar
left a comment
There was a problem hiding this comment.
@TaichKarna One suggestion from my side : could we add a unit test covering - output-format (e.g. json) to verify that webhookViews.ListWebhooks is not invoked/rendered when a format is specified? This would help prevent the same regression from being introduced again in the future.
And the control-flow change looks good to me.
Signed-off-by: TaichKarna <taichikarna@gmail.com>
Author
Yes, added one |
Signed-off-by: TaichKarna <taichikarna@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a bug where
harbor webhook list [PROJECT_NAME]rendered the interactive Bubble Tea table UI in addition to formatted output when--output-format(e.g.-o json) was specified.Type of Change
Please select the relevant type.
Changes
webhookViews.ListWebhooksinside anelsebranch incmd/harbor/root/webhook/list.gowhenoutput-formatis specified.listWebhooksandlistWebhooksViewpackage variables inlist.goto support unit testing.webhook listto verify--output-formatbehavior.webhook listbehavior with other CLI list commands (schedule list,robot list,registry list,repository list,project list).Testing
./bin/harbor-cli webhook list demo -o jsonagainst local Harbor instance. Only formatted JSON is printed.webhook list --output-format.gofmt -s -w .and verified full unit test suite passes:go test ./....