Set environment variables for a project, to be referenced during build steps.

This plugin adds a section to job configuration pages for specifying key/value pairs of environment variables. These environment variables will be available to build steps in both freestyle and Maven projects, including the Ant, Maven, shell, and batch steps in freestyle projects.

Changelog

Version 1.2 (08/14/2011)

Removed unused help files

Version 1.1 (12/28/2009)

Fix help link

Version 1.0 (9/29/2009)

19 Comments

Providing environment variables for a build is already realized by the (Hudson core) job option "This build is parameterized" (see Parameterized Build). What is the difference between your plugin and the core functionality?

If you want a build to start automatically, like from an SCM or a dependency change, you cannot use parameterized builds. Then this plugin is very good to have. In my case, I have some GUI tests that need an X11 display. As I have a cluster, it is very nice to just set the X11 display env.var. with this plugin and not have to do this for every node.

Unknown User (clanjava@gmail.com)

Is it possible to extend this to include "Post Build Actions" as well? Reason being is that we have clear case stream views that change everytime a new stream is created (about once a month). Currently i have to go into every single config area and update the new stream path , for example where the ant script is and in the Post Build in the Archive Area where I want to change where the artifacts will be.

The environment variables sets by the setEnv plug-in (or other similar plugin : envfile and envInject) are available in post-build actions.
However, for the clearcase plugin is a special case. The clearcase streams/baselines are display in the post-build actions section but they are executed in the prebuild method from the job lifecycle.
I suggest using the EnvInject plugin (https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin). It meets your needs and performs injection of environment variables before any job operations.

Unknown User (carl.quinn@gmail.com)

Unknown User (jl.pinardon)

It seems that the plugin cannot be used to pass parameter from an upstream to a downstream job. I mean from a job which triggers another one when it successfully ends.
Am I true, or have I missed something ?

I agree. It will be an handy feature but we will have difficulty providing that in a suitable way.
However, I suggest using the envInject plugin (https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin).
With this plugin, you can set this variable by executing a shell script (or a batch script in your case) at the set up of the job, fill in a Java properties file with this variable (and other) and the computed value. Then, you can inject properties in this new file as environment variables in a build step. With this configuration, you are able to use these environment variables in other build steps and in post-actions.