Is there a way to get the jobname for the current build in jenkins and pass it as a parameter to an ant build script?
BUILD_NUMBER is the current build number. You can use it in the command you execute for the job, or just use it in the script your job executes. See the Jenkins documentation for the full list of available environment variables.
$BUILD_URL is the easiest way to do it, just add it in your Body mail and it will show the hyperlink of your latest build. Save this answer. Show activity on this post. Optionally specify the HTTP address of the Jenkins installation, such as http://yourhost.yourdomain/jenkins/.
Jenkins sets some environment variables such as JOB_NAME
(see here) for more details on the variables set.
You can then access these in ant via ${env.JOB_NAME}
.
Edit: There's also a little howto for environment variables on the same page here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With