I have 2 jobs: "Helper" and "Main" and the single jenkins instance (which is the host and the executor).
The helper manages 3rd party resource and makes the preparation for the Main job (to be precise - it creates the environment for the application to be deployed for testing).
The only artifact for the helper job is a single file with IP of the environment prepared especially for the Main job.
How would I pass back the build from the Helper to the Main in this case?
You are saying that you only need to pass a file with an IP to the "Main" job. If all you need is that IP, there are easier ways of doing it (without files), I will describe both.
In the "Helper" job, you need to archive that file from your workspace.
Now, in the "Main" job, you need to copy this artifact from the previous ("Helper") job.
**/yourartifactname*.*
Your artifact name will be what you configured in "Helper" job. Using **/
in front makes sure it will ignore any directory structure before getting to the artifactNow, your "Main" job has the file from "Helper" job in it's workspace. Use it like you would any other file in your workspace
Like I mentioned, if all you need is that one IP address, that you have as a variable at one point in time in "Helper" job, you just send it to "Main" job using the Trigger/Call builds on other projects step that you configured in steps 3 and 4 of the "Helper" job. In this case, you don't need any special configuration on "Main" job.
VarForMain=$VarFromHelper
, where VarFromHelper
is your environment variable from the "Helper" job that contains your IP address, and VarForMain
is the environment variable that will be set in your "Main" job to this value. There is no reason why these can't have the same name.Now, in your "Main" job, you can reference $VarForMain
as you would any other environment variable
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