Bazel First-Time Setup¶
This document describes how to configure Bazel to connect to an EngFlow Remote Execution cluster.
1. Prepare a Docker container image for remote actions¶
Refer to Create a container image for remote actions, which describes the requirements for a container image, how to build a new image, and where to store your image for best performance.
If you already have a container image you use for local execution in CI, make sure it meets the requirements, then use that. Ideally, your local and remote environments are similar so actions may run either locally or remotely.
To proceed, you'll need to know your container image's URL, including its SHA-256 sum. A complete URL looks like
docker://gcr.io/bazel-public/ubuntu2004-java11@sha256:69a78f121230c6d5cbfe2f4af8ce65481aa3f2acaaaf8e899df335f1ac1b35b5. If your container image is stored on a private registry, you'll also need to ensure EngFlow workers are authorized to pull from it. Ask EngFlow support if you're unsure.
2. Create a remote platform configuration¶
In Bazel, a platform expresses an environment where an action can run. When performing remote execution, Bazel is instructed to build for a special EngFlow platform. This platform carries the Docker image and other environmental configuration to the remote execution service.
If your remote actions require internet access, add
"dockerNetwork": "standard" to
3. Create a C++ toolchain configuration.¶
To construct C/C++ commands that can run remotely, Bazel needs a C++ toolchain configuration. If you have installed a C++ toolchain in your container image, refer to Create a Bazel C++ toolchain configuration for remote actions.
You will likely need a C++ toolchain, even if you don't develop C++ code directly. Many Bazel rulesets use C++ for tools and wrappers.
4. Set up
Configure Bazel to use the EngFlow platform in
Add common flags:
Add platform flags:
If not using a custom C++ toolchain already, add flags for the container's C++ toolchain. Make sure to set
--compilerto match an entry in its
toolchainsattribute. Also set the
--host_*versions of these flags unless you're cross-compiling with a different toolchain.
If Java is required, optionally use the hermetic JDK shipped with Bazel:
Add the remote executor flags. For the
<CLUSTER_ENDPOINT>, use the host name or IP address of the Load Balancer. You may also have to specify the port, if using a non-standard one. The default ports are 443 for grpc/s, and 80 for http/s.
If you use TLS with our certificate (
We recommend using the latest available Bazel version.