-
Bug
-
Resolution: Fixed
-
Major
-
None
-
-
935.0.0
There is such logic in the bitbucket-branch-source plugin:
if (push.getChanges().isEmpty()) {
LOGGER.log(Level.INFO, "Received hook from Bitbucket. Processing push event on {0}/{1}",
newObject[]{owner, repository});
scmSourceReIndex(owner, repository);
}
And this works in case of remote pull request merges. (https://community.atlassian.com/t5/Questions/Pull-requests-Squashed-commits-Remote-Merges/qaq-p/171569)
This leads to reindexing of a multibranch pipeline project which can take a lot of time.
In my case I have a lot of pull requests(around 150) and build for one of them takes around an hour. These pull requests mostly targeted to the same branch. Because of this we rescan our Bitbucket multibranch pipeline only twice a week because it takes a lot of time to rebuild all of these PRs because the target branch has new changes. And if some pull request is merged remotely this leads to the reindexing which is unexpected. This locks me if this happens in the middle of the day.
- relates to
-
JENKINS-35674 Pull requests not rebuilt when destination commit changes
-
- Open
-
- links to
I was able to reproduce the problem in Bitbucket Server with the Native webhook as well as with the Bitbucket add-on. I found 2 scenarios where the empty changes may happen:
Rebase a target branch to a source branch while a PR is open
This will generate 2 events. The first one with empty {changes}} and the next one with the right changes made to the target branch. (The PR is automatically merged because there is no diff and maybe that is why)..
Auto-Sync of Fork when a branch cannot be synchronized
When the Multibranch Pipeline is a fork and Automatic Fork Syncing is enabled. If a branch on a fork cannot be synchronized, the attempt from Bitbucket to synchronize it generates a repo:refs_changed with empty changes. The auto sync seem to kick off a couple of seconds after a change is made to the remote respective branch.
Both the add-on and the native webhook results behave the same. Per my understanding the add-on relies on the native mechanism but add some extra configuration..
But so far, I don't see a valid scenario where a repo:refs_changed with empty changes should be considered. Or why it would trigger branch indexing.
I cannot reproduce such an event in Bitbucket cloud...