BITBUCKET_BRANCH Pipelines Environment Variable is Empty Edited

I'm attempting to use bitbucket pipelines to create docker images and tag them with the branch name. The problem I'm having is that the $BITBUCKET_BRANCH is always empty, which I've checked by echoing the variable as the first step in the build. I've tried this both for branch builds and for custom builds that I run from the branch and in both cases the variable is empty. Here is my yaml file: