-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Report validation errors on pull requests as comment #1963
base: main
Are you sure you want to change the base?
feat: Report validation errors on pull requests as comment #1963
Conversation
feea987
to
a38ec46
Compare
This commit introduces the capability to report PipelineRun validation errors as comments on pull requests. This functionality is triggered when validation errors are detected and the event type is a pull request. The errors are formatted into a markdown table and posted as a comment on the pull request, allowing users to easily identify and address issues in their PipelineRun templates. The commit also includes updates to the provider interfaces to include a CreateComment function, and implementations for GitHub, GitLab, Bitbucket Cloud, Bitbucket Server and Gitea providers. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
1a30d06
to
b63beda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👼🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR adds functionality to report PipelineRun validation errors as comments on pull requests and introduces a new provider interface function CreateComment. Key changes include:
- Reporting PipelineRun YAML validation errors as a markdown-formatted comment on pull requests.
- Adding a CreateComment function implementation across multiple provider packages (GitHub, GitLab, Gitea, Bitbucket Cloud, Bitbucket Server).
- Updating tests and documentation to reflect the new error reporting behavior.
Reviewed Changes
File | Description |
---|---|
test/testdata/failures/pipeline-validation.yaml | New invalid PipelineRun template for testing validation errors |
test/gitea_test.go | Added tests for reporting bad YAML errors on pull requests |
docs/content/docs/guide/running.md | Added documentation for YAML parsing error reporting |
pkg/provider/github/github.go | Added CreateComment implementation for GitHub |
pkg/pipelineascode/match.go | Enhanced error reporting by creating a markdown comment with YAML errors |
pkg/provider/gitlab/gitlab.go, gitea.go, etc. | Added CreateComment implementations for other providers |
pkg/provider/interface.go | Updated provider interface to include CreateComment |
Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.
Changes
This commit introduces the capability to report PipelineRun validation errors as comments on pull requests. This functionality is triggered when validation errors are detected and the event type is a pull request. The errors are formatted into a markdown table and posted as a comment on the pull request, allowing users to easily identify and address issues in their PipelineRun templates.
The commit also includes updates to the provider interfaces to include a CreateComment function, and implementations for GitHub, GitLab, Bitbucket Cloud, Bitbucket Server and Gitea providers.
Jira: https://issues.redhat.com/browse/SRVKP-7075
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).
If adding a provider feature, fill in the following details: