Closed andni233 closed 4 years ago
The following patch can be applied as a workaround:
diff --git a/pkg/buildevents/stream_parser.go b/pkg/buildevents/stream_parser.go
index b5447c2..d2075fc 100644
--- pkg/buildevents/stream_parser.go
+++ pkg/buildevents/stream_parser.go
@@ -551,6 +551,10 @@ func (p *StreamParser) AddBuildEvent(event *buildeventstream.BuildEvent) error {
}
newChild = n
+ case *buildeventstream.BuildEventId_BuildMetadata:
+ delete(p.parents, key)
+ return nil
+
default:
return status.Error(codes.InvalidArgument, "Received unknown build event")
}
This throws away and BuildMetadata events. It is probably not the solution that is desired in the long term, but can be used for now to get a working bb_browser. Tested with Bazel 1.1.0.
Hi @andni233 - were you able to build the image and push it? It doesn't work for me. (I am doing a bazel run //cmd/bb_browser:bb_browser_container_push
)
I am getting the below error
If the definition of 'com_github_bazelbuild_bazel' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'com_github_bazelbuild_bazel':
Traceback (most recent call last):
File "/private/var/tmp/_bazel_<username>/101f959a020b81c2f30d2b04eaa7684b/external/bazel_tools/tools/build_defs/repo/http.bzl", line 59
patch(ctx)
File "/private/var/tmp/_bazel_<username>/101f959a020b81c2f30d2b04eaa7684b/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 100, in patch
ctx.patch(patchfile, strip)
com.google.devtools.build.lib.syntax.EvalException: Error applying patch /Users/<username>/work/base/golang/src/bb-browser/patches/com_github_bazelbuild_bazel/build_event_stream.diff: Incorrect Chunk: the position of chunk > target size
**Original Position**: 191
Another thing is, I even received rpc error: code = InvalidArgument desc = Received unknown build event on bazel version 0.29
EDIT: I just checked at it seems BuildMetadata has been added since Bazel 0.29. https://github.com/bazelbuild/bazel/commit/f3e66adcedb78c0ceb2a0c429336d7530dbbf9fa#diff-729a657d65469267b3e189dafed72b6b
So, Bazel version prior to 0.29 should work. I started using Bazel since the last days of 0.29 and never able to open url generated the build_events/bb-event-service/
@andni233 I tried serveral versions of bazel (0.28.1, 0.29.1, 1.1.0) to build the version with the patch applied, but I either get an error because BuildEventId_BuildMetadata is not yet defined or I get an error similar to the one posted by @boseabhishek
I would greatly appreciate a howto generate a new docker that would make bb-browser work with newer bazel versions (at least 0.29.1, but preferable also with 1.1.0).
As an update: I spent quite some time to build a docker image from the current state of this repo. How anyone managed this is beyond my understanding. I did a fresh clone and when I try to build with any bazel version, it fails. I did not even patch the file. My last try was with 1.1.0 which gave me this:
ERROR: An error occurred during the fetch of repository 'com_github_bazelbuild_bazel':
Traceback (most recent call last):
File "/home/user/.cache/bazel/_bazel_q222150/3112d6d2e075eb52eadcb19a599d6ea5/external/bazel_tools/tools/build_defs/repo/http.bzl", line 83
patch(ctx)
File "/home/user/.cache/bazel/_bazel_q222150/3112d6d2e075eb52eadcb19a599d6ea5/external/bazel_tools/tools/build_defs/repo/utils.bzl", line 139, in patch
ctx.patch(patchfile, strip)
com.google.devtools.build.lib.syntax.EvalException: Error applying patch /tmp/123123/bb-browser/patches/com_github_bazelbuild_bazel/build_event_stream.diff: Incorrect Chunk: the position of chunk > target size
**Original Position**: 191
**Original Content**:
":remote_execution_log_java_proto_srcs",
],
)
-- src/main/protobuf/command_line.proto
**Revised Content**:
":remote_execution_log_java_proto_srcs",
],
)
...
I don't know why the patch cannot by applied if the exact version is referenced, but I 'fixed' that by extracting the ZIP to a local directory, patched the files there manually and created a local_repository with the same target name. Still did not work out with more and different errors (if required, I could post them here as well). Then I thought I would just use the official? bb-browser ( from here: https://hub.docker.com/r/buildbarn/bb-browser/tags) in the hope that it will be new enough to be compatible with a now rather old bazel version. I cannot even get this to start as this one fails to parse the config file. After it complained that it could not parse the config I had for my old instance I was desperate enough and just tried it with the EXACT file that is in the README.md in the repo and it cannot parse it as well, both attempts gave me the error (this one is from running the executable locally, but I get the same if running it from within the docker I pulled from hub.docker.com:
2019/11/15 06:51:33 Failed to read configuration from /home/user/buildbarn/bb-browser/config/blobstore.conf: rpc error: code = Unknown desc = Failed to retrieve configuration: Failed to unmarshal configuration: EOF
Maybe my name says it all but I just seem to be too stupid to follow the instructions from the README? With bazel and everything pinned to the right versions I don't even understand why this can fail in the first place. I would still greatly appreciate any insights and hints what I might be doing wrong.
EDIT: update. Now it's at least clear the documentation is broken and the sample configuration is not usable at all. Not since this commit it seems: https://github.com/buildbarn/bb-browser/commit/2a2a909baf4fb9d498563371742a8b41347a7d67
Hi,
I'm implementing a fix for this now, do we want to use the patch provided by @andni233 or fix it properly by adding the event to the tree?
Bazel >1.0.0 started publishing a new build event, BuildMetadata.
This event is not understood by bb-browser. The result is that instead of a build summary, an error message stating "Received unknown build event" is displayed.