-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[bootstrap]: Add Step::is_supported abstraction
#152201
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
|
i think to fix this failure properly i'd have to add a |
you could set that as base branch using github ui (and it will automatically shift to main branch if that pr gets merged) |
0f3bced to
78dc5be
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
this doesn't seem to work across forks unfortunately :/ |
|
This seems pretty interesting! I mostly examined the second commit to see how it would affect the existing steps. Some initial comments:
|
|
Some answers in no particular order: I think combining this with Perhaps the
oh, hm ... yes, that is what's happening. I agree that it would be nice to combine these three ( Originally I had tried to define enum SupportStatus<Output = (), Input = ()> {
Supported(Input),
Warn(Input),
Skip(Output),
Fatal,
}That allows the logic to be shared between The problem here is that it plays hell with Now, I've thought about combining But on the other hand, if we immediately call I'm not sure what a good approach here is. I'll think about it for a while, maybe someone else will come up with a good idea in the meantime. |
NOTE: this PR is mostly intended to generate discussion. I do not expect these changes to land as-is.
This is built on top of #151930 for convenience. The new commits start with 640e87c.
The first commit adds the new abstraction; the second converts many existing Steps to use it, to give an idea of what it looks like.
See #t-infra/bootstrap > Path filters in bootstrap @ 💬 for previous discussion.
What problems does this solve?
Right now there’s a bunch of adhoc logic to decide whether a Step should be skipped/warn/exit/treated as a default. Usually that logic is related to if some bootstrap tool is missing or whether some config is enabled. It tends to be inconsistent between Steps: some remember to put it in
is_default, some don't. Some unconditionally run the Step and exit with an error if the prerequisite is missing; others silently skip the step.What is the new API?
What is the new behavior?
After this change, all steps choose from one of the following four options. For all options,
Err(_)implies that the step is skipped frommake_run; the error variants only matter forensure.Ok(()): The step is supported. There is no additional default condition.Err(Unsupported::Skip): Return the dummy output passed back in the enum.Err(Unsupported::Warn): Warn, but execute the step anyway.Err(Unsupported::Fatal): Immediately exit.Example output
skip:
warn:
fatal: