Skip to content

Buildkite Integration

This guide will help you setup Buildkite to integrated with your cluster's Build and Test UI.

Render Buildkite user instead of CI hostname in Engflow UI

When the EngFlow BES receives a BEP stream from Bazel it can only attribute builds to the OS username of the CI runner that is running the invocation and/or the principal stated in the certificate used to authenticate to the BES. In many cases this is not actually the user that is responsible for the build.

To fix this, you can send the Buildkite user to the BEP using bazel keywords and your EngFlow cluster will use that name in the UI.

Pipe the BUILDKITE_BUILD_CREATOR Buildkite environment variable into the command you use to run bazel.

YAML
1
2
3
4
steps:
  - label: "My Build"
    command: "bazel build //:my_target ... --bes_keywords=engflow:Requester=$BUILDKITE_BUILD_CREATOR ..."
    ...

Post invocation results back to a Buildkite build

Your EngFlow cluster can post invocation results directly to a Buildkite build to reduce the number of clicks your developers have to make to get to their invocation results.

1. Create a Buildkite API token

Follow this Buildkite guide to create a new Buildkite API token.

Make sure the token has the following permissions:

  • wire_builds Allows the EngFlow cluster to post annotations to your build

2. Configure your EngFlow cluster to authenticate to Buildkite

Contact your EngFlow support engineer and securely send the Buildkite API token. They will add this to your cluster's secrets so the cluster can authenticate to Buildkite using the token.

Please contact us for instructions on how to install and configure the secret into your cluster.

3. Configure your CI Buildkite

Buildkite automatically injects the BUILDKITE_BUILD_URL environment variable into your build scripts. Pass this into the bazel command in your job's steps like so:

YAML
1
2
3
4
steps:
  - label: "My Build"
    command: "bazel build //:my_target ... --bes_keywords=engflow:BuildkiteBuildUrl=$BUILDKITE_BUILD_URL ..."
    ...