jenkins - Accessing a downstream parameter using build flow -
assume have following downstream job:
// downstream job dynamic_var = "" parallel( { dynamic_var = new date() // other value determined // @ runtime job }, { // other stuff... } )
as part of upstream job (see example below) want able call downstream job, , access variable set during downstream job.
// upstream job my_build = build("my-custom-job") // beable // out.println my_build.build.get_var('dynamic_var') // or // out.println my_build.build.dynamic_var
looking through output seems variable not returned, , hence not accessible. suspect because variable in question (dynamic_var) available during scope of downstream job, , hence once job finishes variable removed.
my 2 questions wanted ask were:
- is correct variables removed upon job completion?
- does have idea how could (if can) achieved (additional plugins fine if required)?
1) outputting variable=value pair file acceptable solution you?
2) haven't used groovy in jenkins much, job's environment variables stored under:
${jenkins_home}/jobs/${job_name}/builds/${build_number}/injectedenvwars.txt
this may or may not require envinject plugin.
Comments
Post a Comment