Open MagicRB opened 3 months ago
I think we are experiencing a similar problem in our own case at the moment, as a PR request also triggers a build on the main branch on our own setup.
I'll open a PR with the changes that fixed it for me, can you test if it helps you too? but also we have
# build all pull requests
schedulers.SingleBranchScheduler(
name=f"{project.project_id}-prs",
change_filter=util.ChangeFilter(
repository=project.url,
category="pull",
),
builderNames=[f"{project.name}/nix-eval"],
),
schedulers.SingleBranchScheduler(
name=f"{project.project_id}-default-branch",
change_filter=util.ChangeFilter(
repository=project.url,
filter_fn=lambda c: c.branch == project.default_branch,
),
builderNames=[f"{project.name}/nix-eval"],
treeStableTimer=5,
),
we did not experience duplicate build, Gitea sends two webhooks for each PR push, so I think that's discarding one of them. We were only seeing the one incorrectly attributed to master
There has been some discussion on this on this PR: https://github.com/lab132/buildbot-gitea/pull/21 it's been some time, but the in-between fork stuff etc is a bit and gitea is also a bit different than github in that regard (at least it was, not sure if that has changed in the meantime)
For us it works mostly, except for the branch property being incorrect, which is why I didn't notice. But our code is a bit :sparkle: special :sparkle:
While working on https://github.com/nix-community/buildbot-nix I've noticed that al PR changes are considered as changes to master branch, which differs from what the upstream GitHub upstream webhook handler does, see the attached screenshots:
I think the problem is here, because the
branch
attribute of the change is set tobase["branch"]
when I think it should behead["branch"]
.https://github.com/lab132/buildbot-gitea/blob/master/buildbot_gitea/webhook.py#L102