Build the example project¶
This tutorial guides you through building our EngFlow/example repository to get a feel for using EngFlow. By the end of this exercise, you'll understand the essential benefits of building your own project using EngFlow.
Info
At this time, this walkthrough is only compatible with the Bazel build system. Future documentation will provide guidance for additional build systems that are compatible with the Remote Execution API, such as Buck2 or the Chromium build system (Goma).
Prepare your environment¶
Set up EngFlow¶
If you haven't done so already, be sure to set up your EngFlow instance.
Install Bazel¶
The example project uses the Bazel build system. Please install Bazel on your machine if you haven't done so already.
Clone the example repository¶
The EngFlow/example repository contains examples in various languages that demonstrate how to build and test software with the EngFlow Remote Execution service:
Text Only | |
---|---|
Review any language-specific guidance¶
The README file in the EngFlow/example repository provides guidance
on how to build the code and run the tests for various languages. Perform any
special setup required for the language of your choice. Note which languages
contain available bazel build
and bazel test
targets.
Build the project without EngFlow¶
Run the local bazel build
and bazel test
commands described in the
README to ensure they complete successfully, but skip the remote
execution commands. Follow along with the rest of the steps on this page
instead.
Build the example project using EngFlow¶
Configure the project using the trial cluster¶
Info
If you're using MyEngFlow, you should have already created a
~/.bazelrc
file configured to use your MyEngFlow instance. Skip this
section and continue on to Build targets instead.
Once you've received your trial access, proceed through the following steps,
replacing CLUSTER_NAME
with the name of your EngFlow trial cluster.
-
Log into the cluster UI at
https://CLUSTER_NAME.cluster.engflow.com
-
If your cluster has mutual authentication enabled, download a Mutual Transport Layer Security (mTLS) certificate from:
Text Only This downloads a ZIP file that you need to unpack. We recommend unpacking it into a dedicated
.engflow
directory in your home directory, i.e.,~/.engflow
.The getting started guide link on this cluster page is a link to the Bazel First-Time Setup documentation. We'll return to this documentation in the last step of this exercise.
-
If you're curious, you can view the current state of your trial cluster on the Cluster Status page:
-
Create a
.bazelrc.user
file in your EngFlow/example working directory. The .bazelrc from EngFlow/example imports this file to pick up your local configurations. Create it using the following lines, replacingPATH_TO_CERTIFICATE_DIR
with the absolute path into which you unpacked the certificate files (e.g.,/Users/foobar/.engflow
): -
EngFlow uses Linux x64 by default (
--config=remote_linux_x64
). If you set up a trial for a different architecture, you will need to change this configuration parameter accordingly. See the.bazelrc
file at the top level of the EngFlow/example repo for the correct configuration label for your architecture.
Build targets¶
Info
If you're using MyEngFlow, the instances of
https://CLUSTER_NAME.cluster.engflow.com
in the following output will
appear as http://127.0.0.1:8080
instead.
-
Pick one of the language-specific project directories from EngFlow/example that you'd like to build, and build all targets within that directory. For example, when choosing
java
:Text Only -
You should see output similar to the following in the results (where
INVOCATION_ID
is a globally unique identifier containing hexadecimal digits and dashes):
Inspect results in the UI¶
-
Follow the build results URL in the final line of the output above to view the invocation details page:
Text Only -
Explore this page to get a feel for how the EngFlow UI enables visibility into build results, details, and performance. Note the build summary at the top and the content within each of the tabs (Highlights, Target Tree, etc.).
-
Read the Invocation Details Page documentation for more details about the information presented on this page.
Execute tests¶
-
Run all the test targets within the chosen directory and ensure that they all
PASSED
: -
Run the tests one more time to ensure that Bazel uses the cached results, indicated by
(cached) PASSED
: -
Note the differences in the build summaries and test target details between the two invocations (Target Tree > //java/com/engflow > /example > :ExampleTest). The first invocation runs a bit longer, to fetch necessary infrastructure components, build the targets, and run the tests: Compare this to the second invocation, which shows the entire build and test took only a few seconds, thanks to caching. You can also see that the second invocation reports the exact same test results from the first invocation:
Forge your own project using EngFlow¶
Now that you've successfully built and tested the example project, you're ready to configure your own project to build using the EngFlow cluster! See the Set up your project page for further guidance.