Remote Build Setup¶
Following the steps below will:
- Speed up your builds by running them against the remote execution cluster.
Starting assumptions¶
- You are working on a Linux workstation.
- You are following this guide on a fresh workstation.
- You can run hermetic Chromium builds locally.
Prepare your environment for remote-execution¶
Before remote-execution can work, your local build must be hermetic (as described above).
-
Set some necessary environment variables
- Set
GOMA_SERVER_HOST
to the host name of EngFlow's Goma servers (provided during onboarding). Do not include a port or protocol. Example:foo.goma.engflow.com
. - Set
GOMA_SERVER_PORT
if the server is running on a port other than443
, the default. - Set
GOMA_PROVIDE_INFO
totrue
.
Make sure these variables are always set; for example by adding them to your
.profile
file (or equivalent). - Set
-
More optional environment variables.
GOMA_USE_SSL
controls whether the connection is encrypted. Set tofalse
if not.GOMA_USE_LOCAL
controls whether actions are run locally as well as remotely. If set tofalse
, an action is only run locally if it cannot be run remotely, or if it fails to run remotely first.GOMA_FALLBACK
controls whether an action should run locally after it fails to run remotely. See How-to: only use remote execution for forcing remote execution.
As of 2022-08-01, supported envvars are defined in https://chromium.googlesource.com/infra/goma/client/+/refs/heads/main/client/goma_flags.cc without their
GOMA_
prefix, in theGOMA_DEFINE_
lines. -
Run
gn args out/Default
(the$EDITOR
will open again). -
Append
use_goma = true
into the file; save, then close the$EDITOR
.
This has worked when¶
- Your environment has the variables
Bash | |
---|---|
shows the above environment variables.
out/Default/args.gn
includesuse_goma = true
.
Login to the cluster¶
-
Run
goma_auth login
.Note
The previously supported
--no-browser
flag, which did an Out-of-Band auth flow, no longer works after 2022-10-03. If you're runninggoma_auth login
over SSH, it will print instructions for port-forwarding. -
Accept the PII notice.
- Log in with your Google (company, GSuite) account.
This has worked when¶
There is a Successfully logged in as foo@example.com
.
Check your authentication at any time:
Bash | |
---|---|
... and you should see logged in as foo@example.com
if you are authenticated.
Ensure the compiler-proxy is running with your changes loaded¶
Inside the command shell where your environment variables are set, run goma_ctl restart
.
This has worked when¶
It prints that it succeeded and you can open http://localhost:8088
in your browser.
Troubleshooting¶
Authentication¶
The Goma remoteexec proxy needs to be able to verify your OAuth2 credentials, even if you're running everything on the same host. If you're running the proxy locally for development, you need to ensure that it has access to a GCP service account or user account to do this. For example, to use your GCP user account:
- Run
gcloud auth login
- Set
GOOGLE_APPLICATION_CREDENTIALS=$HOME/.config/gcloud/legacy_credentials/foo@example.com
when runningremoteexec_proxy
.
compiler binary hash mismatch
errors¶
If you see compiler binary hash mismatch
errors, then the remoteexec proxy (the Goma server) was configured with a set of toolchains that does not include those needed by your Chromium checkout. This usually happens after Google releases a new set of toolchains and you've updated to a very new commit requiring those toolchains.
After a toolchain update, EngFlow builds new container images and updates the configuration of the Goma service. We start this process soon after toolchains are released, and it is ordinarily completed within a day. Please ask questions on Slack or alert our on-call engineer to expedite. Once the service is updated, you shouldn't need to take any other action.
Run a small build¶
Run autoninja -C out/Default base_unittests
again and observe running/completed actions at http://localhost:8088
.
This has worked when¶
autoninja -C out/Default base_unittests
succeeds, and ./out/Default/base_unittests{.exe}
is executable.
You can see results at http://localhost:8088
. This is served by the Goma compiler proxy started with goma_ctl
.
Now you can enjoy a fast, full remotely-executed build when running autoninja -C out/Default chrome
.
Optimize your day-to-day workflow¶
-
(one-time) Set the environment variables mentioned above into your user-profile shell-configuration files or otherwise (for example https://direnv.net if you want to source-control them).
-
(every time you want to build) ensure the local compiler-proxy is running and configured:
Bash
How-to: only use remote execution¶
By default, Goma runs each action both locally and remotely, taking the result from the action that finishes first. This can mask problems with remote execution, since the local actions will still succeed.
To force remote execution only, set the following environment variables:
See above for explanation. Actions that can only run locally (like linking) will still run locally.