Branch names vs Tag names

I would like to structure my pipeline so that certain steps only execute when a new tag to master is pushed. The general flow is that feature branches are worked on and merged to master. Then when we are ready, we tag master and trigger a release.

However, when this is done, BUILDKITE_BRANCH and BUILDKITE_TAG both have the tag name. Is the intended behavior? I would have expected BUILDKITE_BRANCH to always be the name of a branch. I understand that branches and tags aren’t that different as far as git is concerned. But it would be helpful if there were a way to determine the base branch that the tag was made against.

Looking at the webhook payload that Github Enterprise sends, it looks like base_ref has the necessary information. Is this something that could be made available if BUILDKITE_BRANCH and BUILDKITE_TAG having the same value is the intended behavior?

Hey @plannigan, sorry you’ve run into trouble here. This one’s definitely a little confusing :confused: Triggering a release from a tag against master is a pretty common practice. Hopefully we can help you get back on track :+1:

Due to how tags work in git, a branch is not easily inferred, nor is it required to check out a tag. For this reason we’re setting BUILDKITE_BRANCH and BUILDKITE_TAG to the same value. This is the intended behaviour. Our docs aren’t really clear on this and we’re updating them now.

If confirming the source branch is an important part of your build process, you could check that the ref that the tag points to exists in master. Another option would be to access the webhook payload in our GraphQL API.

If you’d like us to take a look at a specific build feel free to email :e-mail: