Felipe Nascimento edited a comment on Bug JENKINS-24133

I don't know if its useful for you but, after looking at the output of the env command between build start and git checkout, I found that the GIT_BRANCH environment variable was set with the branch name like origin/featurebranchname, as that was enough for me I set the build name to ${ENV,var="GIT_BRANCH"} and it worked.

Actually the way i thought was working wasn't. So i used the pre-scm-buildstep plugin to create a properties file using the following shell command:

git reflog show --all | grep `echo $GIT_COMMIT | cut  -c1-7` | sed "s/.*\/\(.*\)@{.*/git.branch=\1/g" > jenkins_build.properties

Basically it set the property git.branch on the file jenkins_build.properties to the branch name found using the first 7 chars from commit id.


At the build-name-setter plugin property I used this macro:

${PROPFILE,file="jenkins_build.properties",property="git.branch"}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to