Setting up a Hudson Slave

We recently had to port a legacy application’s continuous integration build from CruiseControl to Hudson.

The setting up of a Hudson slave was pure drudgery! We went down the wrong road a few times, and let me say you will want to avoid this.

Here’s what not to do:

1. Try to avoid using ssh between Linux master and Windows slave:

  • Most of our issues revolved around our legacy ant build using environment variables on the Windows box which Hudson didn’t honour on the slave.
    • Check out this i-proving snip for more details: Slavery 101 – The Hudson Edition
    • Also seems that Sonatype (the Maven development shop) were having similar issues: Check out this great blog series on Hudson HERE
    • We also had issues synchronizing clocks between the Hudson master on Linux and the windows slave. See this snip [link needs updating] for more details.

2. Try to avoid psexec between a Windows master and Windows slave:

  • While trying to fix the issues we had between our Linux master and Windows slaves we temporarily used a Windows master communicating to the slaves using psexec.
  • Although not as problematic as the issues with ssh we again were having environment variable issues.
    • For example the USERPROFILE system variable was being set by Hudson to some truly bizarre value. Here’s the value we had in the Slave’s System Information page:
      USERPROFILE     |    db2.BUILDMACH06.000
      • In this case db2 was the wrong user, BUILDMACH06 was the name of the machine and 000 was…..well who the heck knows!
      • This value could not have been more wrong!

Here’s what you should do:

Launch the Hudson Slave using jnlp:

  • The downside is that the slave needs to know it’s master.
  • The upside is all that you can avoid the mess above
  • Step 1: Configure slave on the Hudson master to use jnlp:

  • Step 2: launch the slave using a jnlpUrl:
    • launch_slave.cmd
      D:\java\jdk1.5.0_10\bin\java -jar slave.jar -jnlpUrl http://<<URL_TO_MASTER>>/computer/<<NAME_OF_SLAVE>>/slave-agent.jnlp
      • NOTE: slave.jar needs java 1.5 on our version of Hudson
  • Step 3: Add the launch_slave.cmd to a startup folder in your user account.

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply