Hope someone can help - I have the following plugin installed in my Jenkins instance - but I don\'t seem to be able to get hold of the Git variables below. I need these to c
Similarly you could just echo them out:
echo GIT_COMMIT %GIT_COMMIT%
echo GIT_BRANCH %GIT_BRANCH%
Here's a quick Jenkins Git configuration tutorial on the Git environment variables topic that uses the Jenkins Git configuration described in the image.
Please also have a look at: How can I access the last built revision according to jenkins?
The part with the env-vars url was really helpful:
Lastly, to see a less comprehensive list of available environment variables, you can also just go to this url: http://[your-jenkins-domain-and-port]/env-vars.html
Ok I cracked this one myself.
To see all environment variables available add to the Execute shell field:
printenv
Console output will then show all the available vars.