build branch name to be passed to bash shell script
Answered
Dear Folks,
I have a Teamcity job that calls my bash shell script and I want to use the value in my Git branch, which I can see as a parameter teamcity.build.branch to be passed to my shell script
But I've tried a few combinations to access this and none of this work
"${teamcity.build.branch}" or {$build.branch} or echo `%teamcity.build.branch%`
Does anyone know a way to do this?
Best regard
Ravi
Please sign in to leave a comment.
Hello,
TeamCity build parameters can be referenced via %parameter% syntax; for the build scripts the references will be replaced with the actual values before execution. I have just checked the below script:
in the shell, and this worked well for me. (You may want to omit apostrophes in the last variant you have tried for the desired effect).
Please let me know if this works for you.
First of all thanks for the response, I must be getting something wrong as it prints
Hi,
One more thing to check... The parameter %teamcity.build.branch% may only be available if there is a branch specification configured for your VCS Root. When there is a branch specification configured, %teamcity.build.branch% will be set to the logical branch name. If you're not using a branch specification, try using %teamcity.build.vcs.branch.<VCS_root_ID>% as follows: