I want to get the job details in Post Build Task plugin and pass the details to the batch/ powershell for further processing.
I am not able to access the Jenkins environment variables like JOB_NAME, JOB_ID etc.
In Post Build Plugin task
Log text "BUILD SUCCESSFUL" OPTION
Script Block: run.bat $JOB_NAME-$JOB_ID
I need to pass the $JOB_NAME-$JOB_ID to the script.
Jenkins Set Environment Variables Equals 'master' for master node. Name of the project of this build. This is the name you gave your job when you first set it up.
This plugin shows information about the environment of a build and gives the option to compare the environments of two builds.
Build Parameters are accesses as $Name in the Execute shell and post build section. You can use
$JOB_NAME
$BUILD_NUMBER
for name of job and build number which is same as JOB_ID.
Also Set "Jenkins user build variables" to get more info regarding Environment variables.
Generally the sintax for accessing variables is the following:
${VARIABLE}
but in some cases, especially when you are trying to access variables using during the build, this sintax can be used:
${ENV, var="VARIABLE"}
That in my case is working also when you have a parameterized build.
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