In your question, it's a bit unclear whether BRANCH_NAME
refers to an environment variable (as in env.BRANCH_NAME
) or to another parameter (as in params.BRANCH_NAME
).
If former, then there's some environment variables, meaning that there's an environment, and so a node must have been allocated with its environment set. To allocate a node, the pipeline needs to start running. To start running, the user needs to select the parameters to run the pipeline. So it's a chicken-and-egg problem: you can't have environment variable before running pipelines, and you need to determine the parameters before running the pipeline.
If latter, and you are thinking of a case where, maybe, there's a String parameter that goes by the name of BRANCH_NAME
, and a Boolean parameter that goes by the name of DEPLOY
, and on the parameters page the checkbox DEPLOY
is unchecked when you type maste
into BRANCH_NAME
, but once you press the r
it magically becomes checked ... then it could be done — with a lot of pain — by using the Active Choice plugin.
Finally, if what you want is to prevent any deploying from the master
branch, you may check for both the parameter and the branch name before deploying, and refuse to deploy if the parameter is false or if the branch is master
.