Allows you to run a script before each build that generates environment variables for it.
Environment Script Plugin allows you to have a script run after SCM checkout, before the build. If the script fails (exit code isn't zero), the build is marked as failed.
Some information about how it runs:
To enable this plugin, go to the configuration page of the job you care about, and check the box named Generate environment variables from script.
In your script, just print "FOO=bar" to the standard output to set that variable.
If you want to append to an existing PATH-style variable, you can do:
Otherwise, you're free to do whatever your heart desires in this script - cat a file, run a script in some other language from your project's source tree, etc.
Matrix jobs are pretty much the same as regular jobs, except you get a new checkbox: Run only on parent. If you enable this option, the script will only run on the matrix "parent" job, and not on the individual "configuration builds" (sub-builds). The environment variables will still be propagated to the children.
This option comes in handy if you need to do something like generate a shared version number based on a timestamp - the code will only run once, but all the different configurations will get the variable. Here's an example - note that ONLY $VERSION is seen by the jobs, not $base_version and $unix_time.
Skip to end of metadata Go to start of metadata