Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set environment variable for build in hudson

I am trying to put a maven2 project under continuous integration in hudson. The project uses selenium for some integration testing. Hudson is running on a headless linux. I am using xvfb to start a x server session for selenium.

In order to run the tests, I need to export an environment variable named DISPLAY. e.g.

export DISPLAY=:99

However, I don't want to set the variable on the box since it would affect all builds. I have tried to do a shell execute using the m2 extra steps plugin but it doesnt work since it is executed in a separate bash file, meaning that environment variables are not persisted.

Is there a way to register the environment variable from hudson.

like image 874
pbreault Avatar asked Aug 25 '09 18:08

pbreault


People also ask

How do I set environment variables in Cloud Foundry?

Using the Cloud Foundry Command Line Interface (cf CLI), you can run the cf env command to view the Application Service Adapter environment variables for your app. The cf env command displays the following environment variables: The user-provided variables set using the cf set-env command.


2 Answers

fyi, I'm releasing the setenv plugin for Hudson today (assuming java.net recovers enough for me to do so!) - it behaves similarly to the parameterized build functionality, but with a simpler UI (just a textarea for input - key/value pairs are separated by newlines) and without the need to provide values for the parameters at build-time.

like image 58
abayer Avatar answered Oct 05 '22 00:10

abayer


There's a new feature in Hudson that allows you to specify parameters for builds. This looks like it does what you want.

Though note that:

warning This is still a very young feature, so feedback appreciated

...

The parameter[s] are available as environment parameters. So e.g. a shell ($FOO, %FOO%) or Ant ( ${env.FOO} ) can access these values.

like image 40
Rich Seller Avatar answered Oct 05 '22 00:10

Rich Seller