Skip to content

feat: add webhook cmd#391

Merged
Vad1mo merged 28 commits into
goharbor:mainfrom
rizul2108:continue-webhook
May 13, 2025
Merged

feat: add webhook cmd#391
Vad1mo merged 28 commits into
goharbor:mainfrom
rizul2108:continue-webhook

Conversation

@rizul2108

Copy link
Copy Markdown
Collaborator

Description

This pull request continues the work initiated in #166

Changes and Improvements

35C4n0r and others added 13 commits August 15, 2024 22:33
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
Signed-off-by: 35C4n0r <jaykumar20march@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108

Copy link
Copy Markdown
Collaborator Author
Screencast.from.12-04-25.11.27.17.AM.IST.webm

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108

Copy link
Copy Markdown
Collaborator Author

@bupd ready for review

@rizul2108 rizul2108 requested a review from Copilot April 15, 2025 05:23

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.

Copilot reviewed 19 out of 24 changed files in this pull request and generated 1 comment.

Files not reviewed (5)
  • doc/man-docs/man1/harbor-webhook-create.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-delete.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-edit.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-list.1: Language not supported
  • doc/man-docs/man1/harbor-webhook.1: Language not supported
Comments suppressed due to low confidence (1)

cmd/harbor/root/webhook/delete.go:67

  • [nitpick] The flag name 'webhook' is inconsistent with other commands (e.g., edit uses '--webhook-id'); consider renaming it to '--webhook-id' for clarity and consistency.
flags.StringVarP(&webhookId, "webhook", "", "", "Webhook ID")

Comment thread cmd/harbor/root/webhook/edit.go Outdated

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

same here need better validation

and also screenshots of each cmd working

@rizul2108

Copy link
Copy Markdown
Collaborator Author

same here need better validation

and also screenshots of each cmd working

I have added the screen-recording of working of the command instead of screenshots does it work
Or should i add screenshots

Comment thread cmd/harbor/root/webhook/list.go
support yaml

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

add valiators

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

small fix

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108 rizul2108 requested a review from Copilot April 18, 2025 05:19

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 continues the work from PR #166 by introducing webhook commands and enhancing input validation for Harbor CLI.

  • Added URL and empty string validator utilities in pkg/utils/helper.go
  • Introduced new webhook-related CLI commands (list, create, edit, delete) and integrated them with the API and interactive prompt
  • Updated and extended the CLI documentation to cover the new webhook functionality

Reviewed Changes

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

Show a summary per file
File Description
pkg/utils/helper.go New helper functions for URL validation and empty string checking
pkg/prompt/prompt.go Added GetWebhookFromUser for interactive selection of webhook
pkg/api/webhook_handler.go Implements listing, creating, deleting, and updating webhook policies
doc/cli-docs/*.md Updated CLI docs to include webhook commands
cmd/harbor/root/webhook/*.go New commands for managing webhooks (list, create, edit, delete)
cmd/harbor/root/cmd.go Registered the new webhook command with the root command
Files not reviewed (5)
  • doc/man-docs/man1/harbor-webhook-create.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-delete.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-edit.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-list.1: Language not supported
  • doc/man-docs/man1/harbor-webhook.1: Language not supported
Comments suppressed due to low confidence (1)

cmd/harbor/root/webhook/delete.go:67

  • The flag for the webhook ID is named 'webhook', whereas in the edit command it is 'webhook-id'. Standardizing the flag naming across commands would improve clarity and consistency.
flags.StringVarP(&webhookId, "webhook", "", "", "Webhook ID")

Comment thread cmd/harbor/root/webhook/edit.go Outdated
Comment thread pkg/prompt/prompt.go Outdated
rizul2108 and others added 4 commits April 18, 2025 10:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Rizul Gupta <112455393+rizul2108@users.noreply.github.com>
Signed-off-by: Rizul Gupta <112455393+rizul2108@users.noreply.github.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108 rizul2108 requested a review from Copilot April 23, 2025 11:17

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 pull request continues the work from #166 by resolving merge conflicts and adding new commands and documentation for managing webhooks in Harbor.

  • Resolved merge conflicts from a previous PR
  • Added implementation for webhook commands in the CLI (list, create, edit, delete)
  • Updated documentation to cover new webhook functionalities

Reviewed Changes

Copilot reviewed 20 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/utils/helper.go Added EmptyStringValidator helper function
pkg/prompt/prompt.go Introduced GetWebhookFromUser for interactive webhook selection
pkg/api/webhook_handler.go Added webhook API functions (list, create, update, delete)
doc/cli-docs/*.md Updated and added CLI documentation for webhook commands
cmd/harbor/root/webhook/*.go Implemented CLI commands for webhook management
cmd/harbor/root/cmd.go Integrated webhook command into the main CLI command structure
Files not reviewed (5)
  • doc/man-docs/man1/harbor-webhook-create.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-delete.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-edit.1: Language not supported
  • doc/man-docs/man1/harbor-webhook-list.1: Language not supported
  • doc/man-docs/man1/harbor-webhook.1: Language not supported

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108 rizul2108 requested a review from bupd April 24, 2025 14:05

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

I have some ideas for improvement.

  1. please maintain consistency among other commands.

Comment thread cmd/harbor/root/webhook/create.go Outdated
Comment thread cmd/harbor/root/webhook/delete.go Outdated
Comment thread pkg/views/webhook/create/view.go Outdated
@bupd

bupd commented Apr 25, 2025

Copy link
Copy Markdown
Member
❯ ./bin/harbor-dev webhook edit --project kumar --name paandi  --description  update

the edit cmd spawns project selection eventhough I specified the project.

fix edit sub-cmd

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

implement changes

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

lint fix

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

left align fix

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

fix left alignment

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@Vad1mo Vad1mo changed the title Continuing Work from #166: add webhook cmd feat: add webhook cmd Apr 29, 2025
rizul2108 added 2 commits May 3, 2025 15:20
test create cmd

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

test all cmds

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

lint fix

Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108 rizul2108 force-pushed the continue-webhook branch from 3ea1b26 to 12c3c2f Compare May 3, 2025 10:37
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>

@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 added the enhancement New feature or request label May 6, 2025
rizul2108 and others added 2 commits May 12, 2025 13:01
Signed-off-by: Rizul Gupta <112455393+rizul2108@users.noreply.github.com>
Signed-off-by: Rizul Gupta <mail2rizul@gmail.com>
@rizul2108

Copy link
Copy Markdown
Collaborator Author

@Vad1mo ready to merge

@Vad1mo Vad1mo merged commit 2a84670 into goharbor:main May 13, 2025
7 checks passed
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.

5 participants