Webhook `repo:refs_changed` events with empty `changes` array

Allan Burdajewicz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 13, 2024

In Bitbucket Server, there are scenario where Bitbucket sends a payload with empty changes array. 

Rebase a target branch to a source branch while a PR is open

If a PR is open on a Bitbucket repository, and a developer rebase the target branch with the source branch of the PR and push to the target.

git checkout main
git checkout -B source-1
echo "test" >> source-1.md
git add . && git commit -m "source-1: $(date)" && git push --set-upstream origin source-1
git push --set-upstream origin source-1

# Open a PR for from the source branch `source-1` to the target branch `main`
git checkout main git rebase -i source-1 git push -f

Bitbucket webhook sends 2 repo:refs_changed  events:

* One with an empty changes array

* Another one with the changes array properly populated

That first event seems un-necessary and does not seem to contain any information that help understand what happened.

As mentioned in the scenario, this only happens if a pull request has been open from the source branch to the target branch. That PR is automatically merged because the diff is empty and I have a feeling that this is why this event is sent...

 

Auto-Sync of Fork when a branch cannot be synchronized

This is another scenario that produces a repo:refs_changes event with empty changes.

When Automatic Fork Syncing is enabled on a fork repository, If a branch on the fork cannot be synchronized with the remote, the attempt from Bitbucket to automatically synchronize it generates a repo:refs_changed with empty changes.

This scenario is odd because no ref has actually changed on the fork...

NOTE: Those have been detected while trying to address an issue reported in Jenkins integrations: https://issues.jenkins.io/browse/JENKINS-55927.

Could those behaviors be bugs in Bitbucket Server webhooks ?

Thanks !

1 answer

0 votes
Allan Burdajewicz
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 6, 2025

Hello team. Any updates about this ?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.3.0
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events