Skip to content

fix(webhook): normalize endpoint URL before validation#800

Open
PrasunaEnumarthy wants to merge 5 commits intogoharbor:mainfrom
PrasunaEnumarthy:fix/webhook-endpoint-normalization
Open

fix(webhook): normalize endpoint URL before validation#800
PrasunaEnumarthy wants to merge 5 commits intogoharbor:mainfrom
PrasunaEnumarthy:fix/webhook-endpoint-normalization

Conversation

@PrasunaEnumarthy
Copy link
Copy Markdown
Contributor

Description

Normalize webhook --endpoint-url values before validating them in the non-interactive create and edit commands.
Other Harbor CLI commands normalize user-provided URLs using FormatUrl(...) before validation. Previously, webhook create/edit commands validated raw input directly, which could reject valid inputs like example.com/webhook that should be normalized to https://example.com/webhook.

Type of Change

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

Changes

  • Normalize --endpoint-url using FormatUrl(...) before validation in webhook create
  • Normalize --endpoint-url using FormatUrl(...) before validation in webhook edit
  • Ensure consistent behavior with other Harbor CLI commands

Signed-off-by: PrasunaEnumarthy <eswari.prasuna@gmail.com>
Copy link
Copy Markdown
Contributor

@NucleoFusion NucleoFusion left a comment

Choose a reason for hiding this comment

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

lgtm
Thanks for the contribution

Copy link
Copy Markdown
Collaborator

@bupd bupd left a comment

Choose a reason for hiding this comment

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

/lgtm

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 8.89%. Comparing base (60ad0bd) to head (bd6840e).
⚠️ Report is 131 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #800      +/-   ##
=========================================
- Coverage   10.99%   8.89%   -2.10%     
=========================================
  Files         173     270      +97     
  Lines        8671   13169    +4498     
=========================================
+ Hits          953    1171     +218     
- Misses       7612   11880    +4268     
- Partials      106     118      +12     

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

Copy link
Copy Markdown
Collaborator

@bupd bupd left a comment

Choose a reason for hiding this comment

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

https://github.com/goharbor/harbor-cli/actions/runs/24009325611?pr=800

Ah, looks like there is linting issues @PrasunaEnumarthy - please fix the lint issues

Thanks for the contribution

@bupd bupd added enhancement New feature or request Changes Requesed feedback that must be addressed before merging. labels Apr 7, 2026
Signed-off-by: PrasunaEnumarthy <eswari.prasuna@gmail.com>
Signed-off-by: PrasunaEnumarthy <eswari.prasuna@gmail.com>
Signed-off-by: PrasunaEnumarthy <eswari.prasuna@gmail.com>
@PrasunaEnumarthy
Copy link
Copy Markdown
Contributor Author

@bupd @NucleoFusion
I’ve addressed the requested changes and added tests to cover the updates.
All checks related to this PR are now passing, and the modified lines are fully covered (codecov/patch is at 100%).

The only remaining failing check is codecov/project, which seems to be related to overall repository coverage rather than this change specifically. Happy to add more tests if needed.

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.

[bug]: Normalize webhook endpoint URL before validation in create/edit commands

3 participants