Set environment variable for build in hudson
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:
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.
Hudson's Node Properties would do a good job here. But if you're looking for a more automated way of assigning the screen number, you'll need to do a little more work, perhaps tying into the port-allocator plugin, or writing a new BuildWrapper plugin which starts up xvfb automatically, and sets the SCREEN environment variable on behalf of the build.
If you're willing to switch to a different X server for testing, you can try the Xvnc plugin for Hudson. It will start the vncserver automatically, and set the SCREEN environment variable as well. It also has the ability to take a screenshot when tests are finished, and show that in the job's Hudson page.
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.