-
Notifications
You must be signed in to change notification settings - Fork 109
fix(bitbucketdatacenter): ignore branch deletion events in ParsePayload #2126
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(bitbucketdatacenter): ignore branch deletion events in ParsePayload #2126
Conversation
/ok-to-test |
this will fail because your commit message is not gitlint compatible
please consider installing pre-commit job |
/ok-to-test |
1 similar comment
/ok-to-test |
A mirrored PR has been created for E2E testing: #2130 |
@chmouel E2E tests are running here? |
One of the e2e tests (TestGiteaACLCommentsAllowing/Retest) failed, but from reviewing the logs, it looks unrelated to this patch. |
@zakisk ah that's actually a nice github behaviour side effect, because we have the same SHA from the mirrored PR, github automatically sees it on this PR as well |
so check-runs are posted in both PRs? that's nice though |
/ok-to-test |
/ok-to-test |
you had a fumpt error which i have pushed to your branch to fix |
Oh I see, but the failing of test persists, with the error: |
/ok-to-test |
💫 Jira ticket created: TP-15862 |
Can we now run e2e tests? |
/ok-to-test |
When a branch is deleted in Bitbucket Data Center, the repo:refs_changed webhook sends a change with toHash set to all-zeros. Previously, Pipelines as Code treated this like a push event, which caused errors when trying to validate a missing commit. This patch detects and ignores such events early in ParsePayload. Fixes openshift-pipelines#2035
/lgtm |
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.
Congrats @infernus01 your PR Has been approved 🎉
✅ Pull Request Approved
Approval Status:
- Required Approvals: 1
- Current Approvals: 1
👥 Reviewers Who Approved:
Reviewer | Permission Level | Approval Status |
---|---|---|
@zakisk | admin |
✅ |
📝 Next Steps
- Ensure all required checks pass
- Comply with branch protection rules
- Request a maintainer to merge using the
/merge
command (or merge it
directly if you have repository permission).
Automated by the PAC Boussole 🧭
/merge |
7340740
into
openshift-pipelines:main
✅ PR Successfully Merged
Approvals Summary:
Thank you @infernus01 for your valuable contribution! 🎉 Automated by the PAC Boussole 🧭 |
Changes
When a branch is deleted in Bitbucket Data Center, the
repo:refs_changed
webhook event contains atoHash
with a zero SHA (0000000000000000000000000000000000000000
). Previously, Pipelines as Code would attempt to process this event as a push, resulting in commit validation failures and noisy logs.This patch updates the
ParsePayload
function to detect and ignore such events early, returning(nil, nil)
when a branch deletion is detected. This ensures branch deletions are not processed like standard push events.Fixes #2035
/kind bug
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:
(update the provider documentation accordingly)