Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Validate Repository URL on creation #1926

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Feb 11, 2025

When creating the repository, the URL must be set and must have a valid scheme (http or https).

Let's add a check on the webhook to make sure the user has provider a proper URL.

Fixes #1852

Changes

Submitter Checklist

  • 📝 Ensure your commit message is clear and informative. Refer to the How to write a git commit message guide. Include the commit message in the PR body rather than linking to an external site (e.g., Jira ticket).

  • ♽ Run make test lint before submitting a PR to avoid unnecessary CI processing. Consider installing pre-commit and running pre-commit install in the repository root for an efficient workflow.

  • ✨ We use linters to maintain clean and consistent code. Run make lint before submitting a PR. Some linters offer a --fix mode, executable with make fix-linters (ensure markdownlint and golangci-lint are installed).

  • 📖 Document any user-facing features or changes in behavior.

  • 🧪 While 100% coverage isn't required, we encourage unit tests for code changes where possible.

  • 🎁 If feasible, add an end-to-end test. See README for details.

  • 🔎 Address any CI test flakiness before merging, or provide a valid reason to bypass it (e.g., token rate limitations).

    (update the documentation accordingly)

@chmouel chmouel force-pushed the validate-url branch 2 times, most recently from 587b5b4 to 771680f Compare February 11, 2025 19:39
pkg/webhook/validation.go Outdated Show resolved Hide resolved
When creating the repository, the URL must be set and must have a valid
scheme (http or https).

Let's add a check on the webhook to make sure the user has provider a
proper URL.

We make the global repository URL mandatory compared to before, but
since we are TP for global repository, we can make still change that
behaviour.

Fixes openshift-pipelines#1852

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@chmouel
Copy link
Member Author

chmouel commented Feb 12, 2025

/label fix

Copy link

✅ Added labels: fix.

@chmouel chmouel added bug Something isn't working documentation Improvements or additions to documentation labels Feb 12, 2025
@chmouel chmouel changed the title Validate Repository URL on creation fix: Validate Repository URL on creation Feb 12, 2025
@chmouel
Copy link
Member Author

chmouel commented Feb 12, 2025

/test prow-commands

@chmouel
Copy link
Member Author

chmouel commented Feb 12, 2025

/assign @zakisk

@pipelines-as-code pipelines-as-code bot requested a review from zakisk February 12, 2025 11:27
Copy link

✅ Assigned zakisk for reviews.

@zakisk
Copy link
Contributor

zakisk commented Feb 12, 2025

/lgtm

Copy link

@pipelines-as-code pipelines-as-code bot left a comment

Choose a reason for hiding this comment

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

✅ Pull Request Approved

Approval Status:

  • Required Approvals: 1
  • Current Approvals: 1

👥 Approved By:

Reviewer Permission Status
@zakisk admin

📝 Next Steps

  • All required checks must pass
  • Branch protection rules apply
  • Get a maintainer to use the /merge command to merge the PR

Thank you for your contributions! 🎉

@zakisk
Copy link
Contributor

zakisk commented Feb 12, 2025

/merge

@pipelines-as-code pipelines-as-code bot merged commit 6540c93 into openshift-pipelines:main Feb 12, 2025
7 checks passed
Copy link

✅ PR Successfully Merged

  • Merge method: rebase
  • Merged by: @zakisk
  • Total approvals: 1/1

Approvals Summary:

Reviewer Permission Status
@zakisk admin

@chmouel chmouel deleted the validate-url branch February 12, 2025 12:04
@chmouel
Copy link
Member Author

chmouel commented Feb 12, 2025

/help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation fix
Development

Successfully merging this pull request may close these issues.

Validate spec.git_provider.url
2 participants