Skip to content
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

branch attribute of change incorrectly set to base branch and not head branch #43

Open
MagicRB opened this issue Jul 15, 2024 · 4 comments

Comments

@MagicRB
Copy link

MagicRB commented Jul 15, 2024

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:

image

image

I think the problem is here, because the branch attribute of the change is set to base["branch"] when I think it should be head["branch"].

https://github.com/lab132/buildbot-gitea/blob/master/buildbot_gitea/webhook.py#L102

@pampersrocker
Copy link
Contributor

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.

@MagicRB
Copy link
Author

MagicRB commented Jul 15, 2024

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

@pampersrocker
Copy link
Contributor

There has been some discussion on this on this PR: #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)

@MagicRB
Copy link
Author

MagicRB commented Jul 15, 2024

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 ❇️ special ❇️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants