bazel-java-sdk
bazel-java-sdk copied to clipboard
Incompatibility with remote execution
Question: Is there any workaround to keep the bazel-java-sdk
code compatible with remote execution?
I recently moved to a remote execution setup. I noticed now that the build event JSON looks a little different (note the uri
field):
Before:
{
...,
"namedSetOfFiles": {
"files": [
{
"name": "main.py",
"uri": "file:///home/tanwang/myproject/main.py",
"digest": "4ff69b370de3d0c25f089d8d4519e9e3123d102b277557dbf11d297245b3cecb",
"length": "14875"
},
{
"name": "lint/lint",
"uri": "file:///home/tanwang/.cache/bazel/_bazel_tanwang/18df9e177741fe13ade143008eeb6c37/execroot/myproject/bazel-out/k8-fastbuild/bin/lint/lint",
"pathPrefix": [
"bazel-out",
"k8-fastbuild",
"bin"
],
"digest": "7c2409e1bfa139742ff574df0d1d7883357cf5da0d8001dc9e9796398f923b0c",
"length": "22061"
}
]
}
}
Now:
{
...,
"completed": {
...,
"importantOutput": [
{
"name": "lint/lint",
"uri": "bytestream://localhost:8980/blobs/7c2409e1bfa139742ff574df0d1d7883357cf5da0d8001dc9e9796398f923b0c/22061",
"pathPrefix": [
"bazel-out",
"k8-fastbuild",
"bin"
],
"digest": "7c2409e1bfa139742ff574df0d1d7883357cf5da0d8001dc9e9796398f923b0c",
"length": "22061"
}
]
}
}
The Problem
Based on this, only file://
URIs are allowed. With remote execution however, seems that they'll always be bytestream
s.
I'm now getting this error:
java.lang.IllegalArgumentException: Expected a file:// uri for property lint/linters/checkstyle.jar, instead got bytestream://localhost:19193/blobs/8a1cb7e84ee859c1a01f5be789c0decd703f0ae323ec9a007a4b49effe1e5aae/325
at com.salesforce.bazel.sdk.bep.event.BEPFileUri.<init>(BEPFileUri.java:96)
at com.salesforce.bazel.sdk.bep.event.BEPEvent.decodeURIFromJsonObject(BEPEvent.java:335)
at com.salesforce.bazel.sdk.bep.event.BEPNamedSetEvent.parseDetails(BEPNamedSetEvent.java:81)
at com.salesforce.bazel.sdk.bep.event.BEPNamedSetEvent.<init>(BEPNamedSetEvent.java:57)
at com.salesforce.bazel.sdk.bep.DefaultBazelBuildEventTypeResolver.createEvent(DefaultBazelBuildEventTypeResolver.java:88)
at com.salesforce.bazel.sdk.bep.BazelBuildEventTypeManager.createEvent(BazelBuildEventTypeManager.java:156)
at com.salesforce.bazel.sdk.bep.BazelBuildEventTypeManager.parseEvent(BazelBuildEventTypeManager.java:131)
at com.salesforce.bazel.sdk.bep.file.BEPFileParser.readEvents(BEPFileParser.java:119)
at com.salesforce.bazel.sdk.bep.BazelBuildEventsFileStream.processFile(BazelBuildEventsFileStream.java:119)
at com.salesforce.bazel.sdk.bep.BazelBuildEventsPollingFileStream$FilePoller.run(BazelBuildEventsPollingFileStream.java:144)
at java.lang.Thread.run(Thread.java:748)
ERROR [com.salesforce.bazel.sdk.bep.BazelBuildEventTypeManager] Error parsing json BEP event [java.lang.IllegalArgumentException: Expected a file:// uri for property lint/linters/checkstyle.jar, instead got bytestream://localhost:19193/blobs/8a1cb7e84ee859c1a01f5be789c0decd703f0ae323ec9a007a4b49effe1e5aae/325]
Is there any workaround to keep the bazel-java-sdk
code compatible with remote execution?
I think this needs an update to make the code compatible. However, we are no longer maintaining this project.
I am hoping to continue work on this project, so re-opening just in case I have a chance to look at it. This project was a subset of the code in the bazel-eclipse project, which has since gone in a different direction.
Hey @plaird, just wondering if you might be looking into this soon or if I should try to find another way. Thanks!
@plaird @guw what kind of change would be needed to get past this error?
It shouldn't be too hard, but setting up the test case will take some work. The main purpose of that class is to load lines of BEP:
https://github.com/salesforce/bazel-java-sdk/blob/master/sdk/bazel-java-sdk/src/main/java/com/salesforce/bazel/sdk/bep/event/BEPFileUri.java#L172
The project currently supports the local file paradigm for this, and not BEP via grpc.
It seems like that class needs to be abstracted a bit, to load lines from either the local file, or the bytestream.