Reputation: 10205
I have a bash script that I execute from a Jenkins job, using "execute shell".
The script starts an EC2 instance and sets an host
variable containing the host name of the new instance.
I would like to set the host name of the new instance (script variable: host
) to a Jenkins environment variable so that I can pass it down to a downstream job (possibly using the Build Flow plugin).
Any idea how to do so?
Thanks
Upvotes: 8
Views: 14956
Reputation: 10205
I ended up using a file to propagate data between builds. The first build creates a file containing the information I need to propagate (host name of the newly created EC2 instance). The file looks like:
host.name=ec2.123.3345.amazon.com
I use the EnvInject plugin to read the file and "inject" the properties that are then available in the next build (I'm using the Build Flow Plugin to orchestrate builds).
Upvotes: 8
Reputation: 1317
There is a plugin that you can install for inject your variable: EnvInject Plugin
If I understood your problem, I think this simple plugin is what you need.
Upvotes: 2