Repository URL
BuildBuddy allows you to group invocations by the repository on which they were run. In order to perform this grouping, BuildBuddy needs the repository’s git url. There are three ways of providing this information to BuildBuddy:- Build metadata
- Workspace info
- Environment variables
The first method is simple - just provide the repo URL with Bazel’s build_metadata flag with the key
REPO_URL. You can do this by adding the following line to your .bazelrc:.bazelrc
Git Branch
BuildBuddy allows you to group invocations by the git branch on which they were run. In order to perform this grouping, BuildBuddy needs the branch name.- Build metadata
- Workspace info
- Environment variables
You can provide the current git branch with Bazel’s build_metadata flag with the key
BRANCH_NAME. You can do this by adding the flag to your bazel invocations:Commit SHA
- Build metadata
- Workspace info
- Environment variables
You can provide the current commit SHA with Bazel’s build_metadata flag with the key
COMMIT_SHA. You can do this by adding the flag to your bazel invocations:Role
The role metadata field allows you to specify whether this invocation was done on behalf of a CI (continuous integration) system. If set, this enables features like Github commit status reporting (if a Github account is linked). For CI builds, you can add the following line to your.bazelrc and run your CI builds with the --config=ci flag:
.bazelrc
This role will automatically be populated if the environment variable
CI is set, which it is in most CI systems like Github Actions, CircleCI, Travis, Gitlab CI, BuildKite, Bitrise, and others.Test groups
If using Github commit status reporting, you can use the test groups metadata field to specify how tests are grouped in your Github commit statuses. Test groups are specified as a comma separated list of test path prefixes that should be grouped together..bazelrc
Visibility
The visibility metadata field determines who is allowed to view your build results. By default, unauthenticated builds are publicly visible to anyone with a link, while authenticated builds are only available to members of your organization. You can override these default settings and make authenticated builds visible to anyone with a link by adding the following line to your.bazelrc:
.bazelrc
User
By default a build’s user is determined by the system on which Bazel is run.BuildBuddy will automatically pull your username from environment variables if you’re using a common CI platform like Github Actions, CircleCI, Travis, Jenkins, Gitlab CI, Bitrise, or BuildKite. The environment variables currently supported are
USER, GITHUB_ACTOR, GITLAB_USER_NAME, BUILDKITE_BUILD_CREATOR, CIRCLE_USERNAME.Build metadata
You can provide your user with Bazel’s build_metadata flag with the keyUSER. You can do this by adding the flag to your bazel invocations:
Workspace info
First, you’ll need to point yourworkspace_status_command flag at a workspace_status.sh file at the root of your workspace. You can do this by adding the following line to your .bazelrc.
.bazelrc
workspace_status.sh file to the root of your workspace that prints USER yourname.
Host
By default a build’s host is determined by the system on which Bazel is run. You can override this using build metadata or workspace info.Build metadata
You can provide your user with Bazel’s build_metadata flag with the keyHOST. You can do this by adding the flag to your bazel invocations:
Workspace info
First, you’ll need to point yourworkspace_status_command flag at a workspace_status.sh file at the root of your workspace. You can do this by adding the following line to your .bazelrc.
.bazelrc
workspace_status.sh file to the root of your workspace that prints HOST yourhost.
Pattern
By default a build’s pattern is determined by bazel command that is run. If the bazel command is:This is generally only needed for advanced use cases where you want to display a more user friendly or information rich pattern in the UI than was originally used on the command line.
Build metadata
You can provide a custom pattern with Bazel’s build_metadata flag with the keyPATTERN. You can do this by adding the flag to your bazel invocations:
Workspace info
First, you’ll need to point yourworkspace_status_command flag at a workspace_status.sh file at the root of your workspace. You can do this by adding the following line to your .bazelrc.
.bazelrc
workspace_status.sh file to the root of your workspace that prints PATTERN yourpattern.
Custom Links
You can add custom links to the BuildBuddy overview page using theBUILDBUDDY_LINKS build metadata flag. These links must be comma separated, and in the form [link text](https://linkurl.com). Urls must begin with either http:// or https://.
Example:
Tags
You can add multiple free-text tags to a build by passing a comma-separated string to theTAGS build metadata flag.
Example:
Using TAG_ prefix for automatic tag creation
As an alternative to using theTAGS field with comma-separated values, you can use build metadata flags piecemeal with a TAG_ prefix. These will automatically be converted to tags by removing the prefix.
Examples:
You can filter by these tags on build history pages and the trends page. Note that when filtering by tags, you will not see in-progress and disconnected builds.
Environment variable redacting
By default, all environment variables are redacted by BuildBuddy except for a whitelist of common CI-related variables which are displayed in the BuildBuddy UI.Redacted environment variables are displayed in the BuildBuddy UI as
<REDACTED>.ALLOW_ENV metadata flag.
The ALLOW_ENV metadata param accepts a comma separated list of allowed environment variables and supports trailing wildcards.
Examples
Don’t redact thePATH environment variable:
PATH environment or any environment variable beginning with BAZEL_: