Running bazel remote test test on separate machines

The bazel remote desktop guide ( here ) explains how to start a remote worker locally and then run bazel against it.

I tried and actually worked (with errors reported in GH )

Another attempt was to create a remote worker launch in a virtual standalone machine by running it inside a docker container and running a base against it. But it failed otherwise, and I think I am using it wrong this time.

Here's my docker file:

FROM openjdk:8

# install release bazel from apt
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN curl https://bazel.build/bazel-release.pub.gpg |  apt-key add -
RUN apt-get update && apt-get install -y zip bazel

# compile dev bazel from sources
RUN mkdir -p /usr/src/bazel
# "bazel" has the latest development code of bazel from github
COPY bazel /usr/src/bazel
WORKDIR /usr/src/bazel
RUN bazel build src/bazel

# compile remote_worker using latest development bazel
RUN bazel-bin/src/bazel build //src/tools/remote_worker

# prepare cache folder
RUN mkdir -p /tmp/test

# Run remote-worker
CMD ["bazel-bin/src/tools/remote_worker/remote_worker","--work_path=/tmp/test","--listen_port=3030"]

      

After creating it, I just started docker, binding the port to localhost:

$ docker build -t bazel-worker .
$ docker run -p 3030:3030 bazel-worker

      

Then bazel java test was run to run using remote worker: (You can check my test repo here )

$ bazel --host_jvm_args=-Dbazel.DigestFunction=SHA1 test \
      --spawn_strategy=remote \
      --remote_executor=localhost:3030 \
      --remote_cache=localhost:3030 \
      --strategy=Javac=remote \
      --remote_local_fallback=false \
      --remote_timeout=600 \
      //src/main/java/com/example/...

      

But I got this strange error message:

____Loading package: src/main/java/com/example
____Loading package: @bazel_tools//tools/cpp
____Loading package: @local_jdk//
____Loading package: @local_config_xcode//
____Loading package: @local_config_cc//
____Loading complete.  Analyzing...
____Loading package: tools/defaults
____Loading package: @bazel_tools//third_party/java/jdk/langtools
____Loading package: @junit//jar
____Found 1 test target...
____Building...
____[0 / 2] BazelWorkspaceStatusAction stable-status.txt
____[2 / 4] Creating source manifest for //src/main/java/com/example:my_test
____From Extracting interface @junit//jar:jar:
/tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: 1: /tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar:      0  !H__PAGEZEROx__TEXTpp__text__TEXT/  __stubs__TEXT0p __stub_helper__TEXT   __gcc_except_tab__TEXT : not found
/tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: 2: /tmp/test/build-80057300-ffd2-49ea-a20b-3f234d9963db/external/bazel_tools/tools/jdk/ijar/ijar: Syntax error: word unexpected (expecting ")")
ERROR: /private/var/tmp/_bazel_ors/719f891d5db9fd5e73ade25b0c847fd1/external/junit/jar/BUILD.bazel:2:1: output 'external/junit/jar/_ijar/jar/external/junit/jar/junit-4.12-ijar.jar' was not created.
ERROR: /private/var/tmp/_bazel_ors/719f891d5db9fd5e73ade25b0c847fd1/external/junit/jar/BUILD.bazel:2:1: not all outputs were created or valid.
____Building complete.
Target //src/main/java/com/example:my_test failed to build
Use --verbose_failures to see the command lines of failed build steps.
____Elapsed time: 13.614s, Critical Path: 0.21s

      

Am I doing something wrong? Do I need to run it differently when running a remote workstation on an actual (or virtual) remote machine (not just locally)?


Important to note : my machine mac osx sierra

... I believe docker openjdk:8

is ubuntu based, I am running local development version bazel (sha 956810b6ee24289e457a4b8d0a84ff56eb32c264

).

+3


source to share


1 answer


Running a remote worker on a different architecture / OS combination than Bazel itself does not work yet. We still have a few places in Basel where we check the local car - they were added as temporary measures, but not yet fixed.

Edit: It may work in some cases, especially for platform independent code (like Java or Scala).

If your build is tested, you can try running tests remotely with --test_strategy = remote; I'm not sure if the default Jvm config will work.



If you want to remotely run an entire build, you need to tell Bazel what machines / OS it is running. Right now this will require installing --host_cpu and possibly --crosstool_top / - host_crosstool_top to set up the C ++ compiler for that platform.

In addition, some combinations of platforms are more or less effective. In particular, combining macOS and Linux, or different Linux flavors, will work significantly more than Windows in any combination.

+3


source







All Articles