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 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

    Cache

    We recommend setting the --cache-push flag to false because during remote build execution, workers upload results to the cache.

  1. Start setting up the Bitrise Build Cache for Bazel: Configuring the Bitrise Build Cache for Bazel in local environments.

  2. Add the RBE endpoint config to your .bazelrc:

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