Skip to main content

Build Intelligence Overview

Build Intelligence is part of Harness CI Intelligence, a suite of features in Harness CI designed to improve build times. By storing these outputs remotely and retrieving them when inputs haven't changed, Build Intelligence avoids unnecessary rebuilds, significantly accelerating the build process and enhancing efficiency.

Build Intelligence is currently available for Gradle and Bazel build tools, with Maven support coming soon. Regardless of the programming language used in your projects, as long as you're building with a supported build tool, you can leverage Build Intelligence to optimize your builds.

Using Build Intelligence

Build Intelligence seamlessly integrates into your workflow without requiring changes to your build commands. Harness automatically detects supported build tools in your pipeline and injects the necessary configurations into the relevant files within the build workspace. This ensures Build Intelligence optimizes your builds during Gradle or Bazel operations performed in Test or Run steps.

To enable Build Intelligence, use the UI editor to enable the stage property Build Intelligence in Build stage overview tab. Alternatively, it can be enabled from YAML editor as shown below.

Below is an example of a CI stage using Build Intelligence:

- stage:
identifier: build
name: build
type: CI
spec:
cloneCodebase: true
buildIntelligence:
enabled: true # Build intelligence enabled
execution:
steps:
- step:
type: Action
name: Set up Gradle
identifier: Set_up_Gradle
spec:
uses: gradle/gradle-build-action@v2
with:
gradle-version: "8.5"
- step:
type: Run
name: build
identifier: build
spec:
shell: Sh
command: ./gradlew build --profile # '--profile' is optional but advised for gradle
info
  • Build Intelligence feature is behind the feature flags CI_CACHE_ENABLED and CI_ENABLE_BUILD_CACHE_HOSTED_VM.

Contact Harness Support to enable the feature.

How does Build Intelligence work

Harness auto-detects supported build tools (Gradle and Bazel). It auto injects required configuration to appropriate files on the build workspace. This will allow Build Intelligence to automatically optimize your builds when bazel/gradle operation are done in Test or Run steps.

Gradle Config

When using gradle, Harness creates an init.gradle file in ~/.gradle/init.d or $GRADLE_HOME/init.d or $GRADLE_USER_HOME/init.d folder if not found, with the required configuration.

Bazel Config

When using bazel, Harness create a ~/.bazelrc file (if it does not exist), with the required configuration.

The config will look like: build --remote_cache=http://endpoint:port/cache/bazel (endpoint is localhost:8082)

Using '--profile'

Appending `--profile' to your build command, enables publishing Build Intelligence savings to Harness. This will allow you to clearly view the performance and benefits of using Build Intelligence. Note that even when omitted, Build Intelligence will continue to work and optimize your run as expected, but the savings will not be visible in the UI and relevant dashboards.

For example: ./gradlew build --profile

This is currently supported with Gradle build tool only .

Build Intelligence Savings

Visit Intelligence Savings for more information.