BuildBuddy Documentation

repository·master·Indexed 20 days ago

https://github.com/buildbuddy-io/buildbuddy

BuildBuddy is an open source Bazel build event viewer, result store, and remote cache providing a web UI for collecting, viewing, and debugging build events. It includes a CLI with plugins for Go syntax highlighting (go-highlight), automatic Gazelle execution (go-deps), desktop notifications (notify), and automatic browser results (open-invocation). Additionally, it features a Codesearch architecture for regex searching and deep code navigation via Kythe integration, supporting languages such as C++, Java, Go, and Typescript.

Tokens
147K
Snippets
428
Records
748
Agent score
73%

What's inside BuildBuddy

  1. Overview of Buck2 build tool

    master

    Buck2 is an artifact-based build tool, similar to Buck(1) and Bazel, that operates on a large graph of dependencies. Rewritten in Rust by Meta, it is designed with the following core principles:

    1. Remote Execution first: Built to support distributed execution environments.
    2. Dynamic graph computation engine: Capable of handling complex dependency graphs.
    3. A single build phase: Streamlines the build process into a unified phase.

    Buck2 is compatible with BuildBuddy's Remote Cache and Remote Build Execution (RBE) offerings.

  2. What is BuildBuddy

    master
    BuildBuddy is a platform providing a UI, distributed cache, and remote execution for Bazel builds. It allows developers to securely compile code, cache artifacts, and visualize build results. For large-scale projects like Tensorflow, it can reduce build times significantly (e.g., from 90 minutes to under 5 minutes) by offloading work to a remote execution platform.
  3. Remote Build Execution features

    master

    BuildBuddy's Remote Build Execution service includes the following capabilities:

    • Custom Docker image support: Use your own container images for build environments.
    • Three-tier artifact caching: Optimized caching layers for build outputs.
    • Stateless, horizontally scalable architecture: Designed for high availability and scale.
    • Automatic executor scaling: The system automatically adjusts the number of executors based on load.
    • mTLS authentication: Secure communication using mutual TLS.
    • Build without the bytes: Optimization to reduce data transfer requirements.
    • Action deduplication / merging: Reduces redundant work by identifying and merging identical build actions.
  4. BuildBuddy v2.5.0 Feature Highlights

    master

    In addition to the core UI improvements, v2.5.0 introduced several backend and integration capabilities:

    • Storage & CDN: Support for serving static files from a CDN and using MinIO as a storage backend.
    • Observability: Support for distributed tracing backends such as Jaeger and Google Cloud Trace.
    • CI Integration: Buildkite links now point directly to the specific Buildkite job that spawned the invocation.
    • Flaky Test Support: Improved explicit callouts for flaky tests and timeouts, along with RBE improvements to reduce flakes caused by external factors like Docker image pulls.
  5. BuildBuddy Enterprise Features Overview

    master

    BuildBuddy Enterprise provides advanced capabilities for large-scale build environments, including:

    • Authentication: OpenID Connect (OIDC) support for integration with providers like Okta, GSuite, and Auth0.
    • Programmatic Access: A dedicated BuildBuddy API for querying build results.
    • Remote Build Execution (RBE): Support for custom Docker images.
    • Storage Management: Configurable TTL (Time To Live) for build results and cache, with support for persistent build artifact storage.
    • Scalability & Availability: High availability (HA) configurations and horizontal scaling using Kubernetes Horizontal Pod Autoscaler (HPA).
    • Support: Enterprise-grade support and uptime guarantees.
  6. BuildBuddy CDC Implementation Details

    master

    BuildBuddy provides end-to-end support for CDC across the server, executors, and the cache path:

    • Server Side: Implements SplitBlob and SpliceBlob. Chunks are stored as standard CAS entries. The server can optimize transfers by skipping existing chunks and performing parallel transfers of missing ones.
    • Executors: BuildBuddy executors (v2.261.0 or newer) can upload large action outputs as chunks directly. They compute chunk digests, call FindMissingBlobs, and upload only missing pieces by reading byte ranges from the original file to avoid high memory usage.
    • Compatibility: CDC is enabled automatically for CDC-eligible execution requests. Existing unchunked cache paths remain functional for clients that do not support the new APIs.
  7. Understand the Executor image composition

    master

    The executor image package defines the base container image shipped with the executor release. It contains most system dependencies required by the executor, such as docker and podman.

    Note that the actual executor binary and certain Bazel-provisioned tools (like firecracker) are not part of this base Dockerfile; they are added separately via //enterprise/server/cmd/executor:executor_image.

  8. Use the BuildBuddy MCP server for agentic workflows

    master

    BuildBuddy's Model Context Protocol (MCP) server provides tools that allow AI agents to explore build and test metadata, logs, artifacts, and target statuses without manually constructing API requests. This enables workflows where agents can automatically check failing CI tests, investigate performance issues, or produce diagnostics during CI runs.

    Note on Tool Stability: MCP tool names are subject to change. It is recommended to provide agents with generic instructions (e.g., "Explore build data to find the cause of failure") rather than hardcoding specific tool names in agent instructions like AGENTS.md or custom skills.

  9. What is Remote Bazel

    master

    Remote Bazel is a feature that allows you to execute commands (including Bazel commands and arbitrary bash commands) on a remote runner. It dynamically spins up a VM to execute the requested command, meaning you do not need Bazel installed on your local machine to initiate a build.

    Key Benefits:

    • Platform Control: Easily configure the OS, architecture, and container image of the remote runner.
    • Performance: Runners are colocated with BuildBuddy servers for fast network connections to RBE & caching servers, and workspaces are recycled to provide warm Bazel instances.
    • Automatic Sync: The CLI automatically syncs your local git workspace with the remote runner. It uploads and applies local diffs so that local code changes are reflected in each remote build without needing to push/pull.
    • Resource Offloading: Allows developers to run heavy builds on powerful remote machines (high CPU/RAM/Disk) or run multiple parallel builds without consuming local resources.
  10. Optimize build graph via modularization

    master

    To maximize the benefits of Bazel's incremental compilation and remote execution, you should modularize your project:

    1. Split into many small modules: Large modules force massive recompilations when code changes. Small modules ensure only a minimal portion of the code is recompiled.
    2. Aim for a 'wide' build graph: Adjust dependencies so the graph is wide rather than deep. A wider graph allows for more parallel compilation and better utilization of remote execution resources.