Skip to main content

Remote build execution for Bazel

Abstract

Remote execution of a Bazel build allows you to distribute build and test actions across multiple machines. This speeds up build and test execution, allows reuse of build outputs across development teams, and provides

Remote execution of a Bazel build allows you to distribute build and test actions across multiple machines. This speeds up build and test execution, allows reuse of build outputs across development teams, and provides a consistent environment.

You can use the Bitrise Build Cache with remote build execution both on Bitrise and in a non-Bitrise CI environment.

Configuring remote build execution on Bitrise

Workflow Editor

Configuration YAML

  1. Set up the Bitrise Build Cache for Bazel: Configuring the Bitrise Build Cache for Bazel in the Bitrise CI environment.

  2. Log in to Bitrise and select Bitrise CI on the left, then select your project.

  3. Click the Workflows button on the main page.

  4. In the Bitrise Build Cache for Bazel Step, set the Enable Bazel RBE input field to true.

  1. Open your configuration YAML file.

  2. Add the activate-build-cache-for-bazel Step to your Workflow.

    your-workflow:
      steps:
        - git-clone: {}
        - activate-build-cache-for-bazel:
            inputs:
            - enable_rbe: true

Configuring remote build execution in a non-Bitrise environment

Other CI

Local environment

  1. Start setting up the Bitrise Build Cache for Bazel: Configuring the Bitrise Build Cache for Bazel in non-Bitrise CI environments.

  2. When enabling the Bitrise Build Cache, add the --rbe flag.

    /tmp/bin/bitrise-build-cache activate bazel --cache --cache-push=false --rbe
  1. Start setting up the Bitrise Build Cache for Bazel: Configuring the Bitrise Build Cache for Bazel in local environments.

  2. When enabling the Bitrise Build Cache, add the --rbe flag.

    /tmp/bin/bitrise-build-cache activate bazel --cache --cache-push=false --rbe

Adding the RBE endpoint directly

To use RBE in local development environments, you can also point Bazel at the Bitrise Accelerate service directly without using CLI:

--remote_executor=grpcs://bitrise-accelerate.services.bitrise.io:443

Keep the --remote_cache= line that the Build Cache CLI injects: artifacts produced remotely are automatically written there.