Issue
I have branch with this format: release/1.0.0
When I use ${GIT_BRANCH}, I get the following: origin/release/1.0.0
I have tried using EnvInj to set a variable like this:
If I leave ${GIT_BRANCH} the way it is it works fine, but if i use ${GIT_BRANCH, fullName=false}. It is always a empty string.
I have also tried using: How to receive local Git branch name with Jenkins Git plugin?
What is correct format to get just 1.0.0.0-rc134
Solution
You can always write a small bash script to get this done.
Use a execute shell build step
echo "RELEASECANDIDATE=${GIT_BRANCH##*/}-rc${BUILD_NUMBER}" > ${WORKSPACE}/inject.txt
Use a Inject shell and in the properties file section give the file name
${WORKSPACE}/inject.txt
Finally in the update build name , use macro below variable
${RELEASECANDIDATE}
This should get you correct value as expected
Answered By - prudviraj