In Jenkins/Hudson, with the help of a Postbuild Groovy script, I would like to get one of the following:
Using Jenkins v2.17 this works for me:
echo "BUILD_NUMBER=${env.BUILD_NUMBER}"