BUILDKITE_TRIGGER_FROM_* variables not set when Rebuild

Today, the BUILDKITE_TRIGGERED_FROM_* variables are set to "" when you click “Rebuild” button on a build that was triggered from another build. This seems unintuitive to me since Rebuilding should preserve all of the environment variables the original one kicked off with. The exception could be BUILDKITE_SOURCE.

Not sure if this is a bug or feature.

Ooh, good spot @ngan! Technically a rebuilt build wasn’t triggered, so doesn’t have a triggered from build, sorry. You could instead look at the BUILDKITE_REBUILT_FROM_* variables?

Wouldn’t that give me the ID of the build that I clicked “Rebuild” on? I actually want the slug of the build that triggered the one I’m rebuilding.

This got inception real fast…

Let’s draw this out:

  1. Original build
  2. Build triggered by build 1
  3. Rebuild of build 2. I would like to get build 1 slug from here.

Yeah, I think that’s the only way to do it for now. You might need to use the REST API to walk the builds. But I do agree that the rebuilds should include those trigger build details. I’ll see if we can add that env, but I can’t promise when it will happen sorry.