title: What is the branch name variable for Jenkins multibranch pipelines?
body: <p>I need to know which branch is being built in my Jenkins multibranch pipeline in order for it to run steps correctly.</p>
  <p>We are using a gitflow pattern with <code>dev</code>, <code>release</code>, and <code>master</code> branches that all are used to create artifacts. The <code>dev</code> branch auto deploys, the other two do not. Also there are <code>feature</code>, <code>bugfix</code> and <code>hotfix</code> branches. These branches should be built, but not produce an artifact. They should just be used to inform the developer if there is a problem with their code.</p>
  <p>In a standard build, I have access to the <code>$GIT_BRANCH</code> variable to know which branch is being built, but that variable isn't set in my multibranch pipeline. I have tried <code>env.GIT_BRANCH</code> too, and I tried to pass <code>$GIT_BRANCH</code> as a parameter to the build. Nothing seems to work. I assumed that since the build knows about the branch being built (I can see the branch name at the top of the console output) that there is something that I can use - I just can't find any reference to it.</p>