-
Notifications
You must be signed in to change notification settings - Fork 226
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
[WIP] Bazel Build Event Stream support #811
base: main
Are you sure you want to change the base?
Conversation
Provide a BuckEvent Publisher service which emits BuckEvents to an external server implementation. Closes facebook#226
Repurposes the RemoteEventSink used to connect to Scribe within Meta internal Buck2 and connects it to a Bazel Build Event Service over gRPC instead. Adds a translation layer between Buck2 build events and Bazel build events.
Hi @aherrmann , thanks for putting this together, we are really looking forward to it. I tested it out and had a couple of questions:
Thanks again! |
It's needed for the target use-case. So, I'm planning to add support for it.
The BES client runs as a thread in the Buck2 daemon. Currently, there is just a bit of printf-debugging in the code. Buck2 has some logging facilities, see |
Thanks again for your help @aherrmann. |
I'm currently testing and developing against BuildBuddy. To my understanding so far, that implementation seems to largely ignore lifecycle events, at least I haven't spotted a need for them, yet. (I may be wrong, I'm not deeply familiar with the BuildBuddy implementation). So, for now, I'm not planning to add lifecycle events. |
BuildBuddy uses pattern expand messages to collect the set of targets to report on. Buck2 does not have a direct correspondance to the target completed message, for now we collect all targets for which actions are completed and then emit a series of target completed events before we close the stream. Stdout and stderr are only included inline in Buck2 and not as CAS items, so we forward them as inline data. Failure details are used by BuildBuddy to display build errors in the UI, so we emit these.
Incremental update: I've added the necessary events to display targets, actions, command-lines, and command failure messages in the BuildBuddy UI for simple, local builds. To reproduce
|
Thanks @aherrmann, I think your current process of develping against BuildBuddy makes sense as an initial approach to validate your POC. I confirmed with some colleagues and our reading of the protocol is that there should be some lifecycle events in order to produce a legal event stream. Particularly The protocol mandates that I'm happy to talk more about this if you feel strongly that lifecycle events are really not needed and ask some of my colleagues with more experience on the protocol to chime in too. Thanks again for your work on this feature! |
This PR adds support to connect Buck2 to a Bazel Build Event Stream server as found among some Bazel remote build execution platforms. It repurposes the existing RemoteEventSink used to connect to Scribe within Meta's internal Buck2 version and connects it to a Bazel Build Event Service over gRPC instead, and it adds a translation layer between Buck2 build events and Bazel build events.
This is a work in progress, only very few build events are translated so far. To test this code you can
examples/hello_world
directory,BES_URI
environment-variable, and$ cargo build --bin=buck2 $ cd examples/hello_world $ BES_URI=XYZ ../../target/debug/buck2 build :main
For example, with BuildBuddy, if you run
bazel run server -- -app.log_level debug
locally, setBES_URI=http://localhost:1985
.The Buck2 Trace-ID is used as the BES invocation ID and you can see a Buck2 build on the UI under e.g.
http://localhost:8080/invocation/e3123cfa-c350-432b-9784-8b3fe48bed14
.