Let me clarify your problem. You have defined the BUILD_BRANCH environment variable and want to be able to refer to it from a parameter for your assembly. Is it correct?
If this is the case, then I solved your problem!
When the parameters are evaluated (and any variables associated with them are expanded), you do not have access to the environment variables, so the parameter value ends with the letter "$ {BUILD_BRANCH}", and is not expanded to the $ BUILD_BRANCH environment definition.
Then, when you reference a parameter from a shell script, the parameter value is surrounded by single quotes, which prevents the removal of an extra layer of indirection, so you get the name of your environment variable, not its value.
The solution is to add eval to the beginning of each line of the shell script, where you refer to a parameter that will allow an extra level, and the variable will work.
Last: you do not need to do this if you are referencing the previous parameter. Therefore, if Param1 is foo and Param2 is $ {foo} bar, this will work because the parameters are evaluated in order. However, if the parameter values have been switched, you will need to use eval.
Cam jackson
source share