How to set environment variable from a job and use it in next job in jenkins? -
i want have job set environment variable , use these environment variables in next jobs. how can set environment variable through jenkins ?
technically, can't pass env variables 1 job next, , i'm not aware of plugin out of box.
there technique however. idea create properties file in first job (e.g. exported.properties), add file job artifacts, , import file via envinject plugin in second job.
this pre-supposes have link between first , second job, typically achieved copy artifact plugin, number of workflow-like plugins can well.
for example, creating properties file, add step "execute shell", e.g.
echo "# saving version properties build_version=${buildversion} build_node_name=${node_name} source_job=${job_name} " > ${workspace}/buildversion.properties
of course, can use other build steps, e.g. windows shell, groovy script, etc... each specific syntax of course.
Comments
Post a Comment