title: Set Jenkins environment variable in Python
body: <p>I'm building a Jenkins setup to automate the our iOS (Xcode) builds.</p>
  
  <p>The flow right now is as follows:</p>
  
  <ol>
  <li>Build is triggered remotely. Passing the app's name, bundle ID, provisioning profile URL (among other data).</li>
  <li>Jenkins fetches the latest codebase version from git.</li>
  <li>A Python script is run to edit the app's Info.plist file based on the data provided in the trigger. This Python script also installs the provisioning profile using <a href="https://stackoverflow.com/questions/10398456/can-an-xcode-mobileprovision-file-be-installed-from-the-command-line">this approach</a>.</li>
  <li>Jenkins uses the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin" rel="nofollow noreferrer">Xcode Plugin</a> to build the project.</li>
  </ol>
  
  <p>The Xcode Plugin allows you to specify the provisioning profile UUID to use to build the app. The Python file in step 3 gets this UUID. So now what I need is to save that UUID so it's accessible in a normal text form for the Xcode Plugin to use.</p>
  
  <p>I've used the <a href="https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin" rel="nofollow noreferrer">EnvInject Plugin</a> to create and set an environment variable, which works and is usable in the Xcode Plugin's. But I cannot set this environment variable from any script (Python or Shell) while the job is running, it can only be hard-set in the job's configuration page.</p>
  
  <p>Hope someone can help. Thanks!</p>