I have 3 jobs configured on jenkins build flow and the desired activity is to get dynamic variables resulted from post-build task of b1 to b2 and variables of b2 to b3 and so on so forth.
list = ["foo", "bar"]
b1 = build("ExecuteJob1", param1: list[idx])
b2 = build("ExecuteJob2", param1: <some dynamic variable from b1>)
b3 = build("ExecuteJob3", param1: <some dynamic variable from b2>, param2: some dynamic variable from b1)
As specified above, there are dynamic variables generated by each previous job (as a part of post build action - I'm using description setter plugin in one instance to generate one dynamic variable and other I want BUILD_URL of b1 to be used in b3)
In order to accomplish this, I came across a post present in this link and used EnvInject Plugin. Using this I performed the following -
But the issue I am facing is that those newly injected variables are not available for b2 to access and the same case for b3.
So, is there any option to get those b1 variables to b2 (so on and so forth) or is there any better way to achieve the desired ?
I got solution for the above question, as specified by @Dave Bacher in the above link,
This allowed me to access those parameters in other jobs of build flow
b1 = build("ExecuteJob1", param1: list[idx])
b2 = build("ExecuteJob2", param1: b1.dynamicVariableX)
b3 = build("ExecuteJob3", param1: b1.dynamicVariableY, param2:nb2.dynamicVariableZ)
This works perfectly allowing to access dynamic variables through environment