It is impossible to fulfill exactly what you ask. A process cannot change the environment variables of another process. Preliminary and post-actual assembly steps are performed in different processes.
But you can create a script that sets common environment variables and shares this script between all your assemblies.
First, call your shell to execute the commands in the script, and then call xcodebuild:
The script might look like this:
export VARIABLE1=value1 export VARIABLE2=value2
How exactly your tasks will share the script depends on your environment and usage. You can
- place the script in some famous place on the Jenkins host or
- place the script in the version-controlled source code tree if all your jobs have a common repository or
- place the script in your own repository and create a Jenkins assembly that archives the script as an assembly artifact. Then all other jobs will use the Copy Artifact plugin to get a copy of the script from the script job artifacts.
source share