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

Configurable branches #312

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

MagicRB
Copy link
Contributor

@MagicRB MagicRB commented Oct 5, 2024

No description provided.

@MagicRB MagicRB changed the title Fix some errors mypy was throwing my way Configurable branches Oct 5, 2024
buildbot_nix/__init__.py Outdated Show resolved Hide resolved
nix/master.nix Outdated Show resolved Hide resolved
nix/master.nix Outdated Show resolved Hide resolved
@MagicRB MagicRB mentioned this pull request Oct 9, 2024
@MagicRB
Copy link
Contributor Author

MagicRB commented Oct 10, 2024

I need a second pair of eyes on 243aa6b97b4b6d062ac85c6c076676ea5acbd3ca the way I'm reading that is that updating build outputs and gcroots would execute also for PRs, which seems like a recipe for disaster.

return branch_config.do_register_gcroot(
await s.getProperty("default_branch"), await s.getProperty("branch")
) and await s.getProperty("event") == "push" \
and not Path(str(gc_root)).exists() and Path(str(gc_root)).readlink() == str(out_path)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and not Path(str(gc_root)).exists() and Path(str(gc_root)).readlink() == str(out_path)
and not (Path(str(gc_root)).exists() and Path(str(gc_root)).readlink() == str(out_path))

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suspect this throws an exception errors if the file at gc_root isn't a link. not sure where the best place to check for that is and whether we strive for that level of diligence at this stage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will throw yes, but its fine ish, since we control that unless the instance admin goes out of their way to screw with it, itll be fine

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless the instance admin goes out of their way to screw with it

hehe, poor admins take the blame :-) fine for now.

please do consider the code suggestion, it's unrelated to the exception discussion and important to fix IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right precedence, will apply thanks!


return branch_config.do_register_gcroot(
await s.getProperty("default_branch"), await s.getProperty("branch")
) and await s.getProperty("event") == "push" \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding #312 (comment) i expect this to prevent registering gcroots for PRs unless the source branch of the PR is one of the branches that match the regex and has set register_gcroots = true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot match on source branches sadly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without making a network requests to girhubs api, or maybe, hm ill check it again, there might be a way. Maybe it arrives over the webhook but buildbot discards it?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant that if this branch that receives the push happens be a source branch for a PR then it register a GC root. under all other circumstances i foresee this to not register GC rootfs for PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pr branch names are pull/number or smth like that

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, then i think your concern from the linked comment doesn't apply because the branch name won't ever match in case of a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah youre right, my bad. I'll recheck this and make a flow chart smth, this whole process is getting very very confusing and tbh im a bit lost myself. Flow chart it is

nix/master.nix Outdated Show resolved Hide resolved
nix/master.nix Outdated Show resolved Hide resolved
@MagicRB
Copy link
Contributor Author

MagicRB commented Nov 10, 2024

Holy... maybe I should squash these commits? 16 commits is a bit excessive...

@MagicRB MagicRB marked this pull request as ready for review November 10, 2024 20:05
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

Successfully merging this pull request may close these issues.

4 participants