This is a βsolutionβ designed for us. The basic idea is that the setup_env.sh
script launches a new shell in which it exports a bunch of environment variables. We needed access to these variable definitions. So, we made three parts of Jenkins Build:
Step 1 - Run the Shell
Use the "Execute Shell" Jenkins to run our setup_env.sh
script. Then load the recently launched shell with a simple python script that unloads the environment into a file.
/path/to/setup_env.sh . <<< 'python <<SC print "Exporting env to buildenv.properties file" import os f = open("buildenv.properties", "w") env = os.environ for k in env: f.write("%s=%s\n" % (k, env[k])) f.close() print "Done exporting env" SC'
Step 2 - Input Environment Variables
Now we use EnvInject Plugin to input environment variables from the file that was dumped in the previous step. The configuration here is simple, just specify the file name of the reset properties as the value of the Properties File Path
field.
Step 3 - Call Ant
Here we run the normal ant
build. Since the environment now contains all the necessary definitions, the assembly completes as usual.
source share