How are Buildkite Build Creator Environment Variables Populated?

Hi! Had a question about the environment variables as described on the environment variables page

  • BUILDKITE_BUILD_CREATOR
  • BUILDKITE_BUILD_CREATOR_EMAIL
  • BUILDKITE_BUILD_CREATOR_TEAMS

How specifically are these fields populated? Presumably if the user kicks off the build from the Buildkite UI itself, it’ll take that user and populated :allthethings:

In the flow of being triggered by the source control system via webhook, presumably it takes some metadata from the source control system. What specifically is that? For example, if the source control system is git, does the email as specified in the author of the commit get mapped to a Buildkite user, and from that the name and teams are discovered?

Similarly, in the flow of a build being triggered by one of our systems via the GraphQL API, how are these questions answered? Does it inherit permissions based on our user which is triggering the build via the API – I ask specifically since this doesn’t seem to be the case, as I’m seeing the actual author of the commit instead of our service user.

Thanks!

Hey @amukherjee,

Good question!

The general flow is that we look for the author first (commit author), otherwise, we look for the build creator and do our best to map that to a Buildkite User (and the associated teams if they are enabled and they exist).

The flow kinda looks like this:

​BUILDKITE_BUILD_CREATOR => We first look for a build author, otherwise, we look for the build creator.

​BUILDKITE_BUILD_CREATOR_EMAIL => we use the BUILDKITE_BUILD_CREATOR value and look for the preferred email, otherwise, we look for the email in the build author and try and find the value there.

​BUILDKITE_BUILD_CREATOR_TEAMS => we look for the associated teams for the build author, otherwise, we look for build creator.

So in both those cases you mention, I would expect that we would take the author first if it exists.

1 Like