Skip to end of metadata
Go to start of metadata

It is pretty common when starting with Jenkins to have a single server which runs the master and all builds, however Jenkins architecture is fundamentally "Master+Agent". The master is designed to do co-ordination and provide the GUI and API endpoints, and the Agents are designed to perform the work. The reason being that workloads are often best "farmed out" to distributed servers. This may be for scale, or to provide different tools, or build on different target platforms. Another common reason for remote agents is to enact deployments into secured environments (without the master having direct access). 

Many people today use Jenkins in cloud environments, and there are plugins and extensions to support the various environments and clouds. These may involve Virtual Machines, Docker Containers, Kubernetes (for example see Jenkins-X), EC2, Azure, Google Cloud, VMWare and more. In these cases the agents are managed for you typically (and in many cases on demand, as needed), so you may not need to read the content of this document for those cases. 

This document describes this distributed mode of Jenkins and some of the ways in which you can configure it, should you need to take control (or maybe you are curious)

 

Contents

How does this work?

A "master" operating by itself is the basic installation of Jenkins and in this configuration the master handles all tasks for your build system. In most cases installing an agent doesn't change the behavior of the master. It will serve all HTTP requests, and it can still build projects on its own. Once you install a few agents you might find yourself removing the executors on the master in order to free up master resources (allowing it to concentrate resources on managing your build environment) but this is not a necessary step. If you start to use Jenkins a lot with just a master you will most likely find that you will run out of resources (memory, CPU, etc.). At this point you can either upgrade your master or you can setup agents to pick up the load. As mentioned above you might also need several different environments to test your builds. In this case using an agent to represent each of your required environments is almost a must.

An agent is a computer that is set up to offload build projects from the master and once setup this distribution of tasks is fairly automatic. The exact delegation behavior depends on the configuration of each project; some projects may choose to "stick" to a particular machine for a build, while others may choose to roam freely between agents. For people accessing your Jenkins system via the integrated website (http://yourjenkinsmaster:8080), things work mostly transparently. You can still browse javadoc, see test results, download build results from a master, without ever noticing that builds were done by agents.  In other words, the master becomes a sort of "portal" to the entire build farm.

Since each agent runs a separate program called an "agent" there is no need to install the full Jenkins (package or compiled binaries) on an agent. There are various ways to start agents, but in the end the agent and Jenkins master need to establish a bi-directional communication link (for example a TCP/IP socket) in order to operate.

Follow the Step by step guide to set up master and agent machines on Windows to quickly start using distributed builds.

 

Master to agent connections

The most popular ways agents are configured are via connections that are initiated from the master. This allows agents to be minimally configured and the control lives with the master. This does require that the master have network access (ingress) to the agent (typically this is via ssh). In some cases this is not desirable due to security network rules, in which case you can use Agent to master connections via "JNLP".

Agent to master connections

In some cases the agent server will not be visible to the master, so the master can not initiate the agent process. You can use a different type of agent configuration in this case called "JNLP". This means that the master does not need network "ingress" to the agent (but the agent will need to be able to connect back to the master). Handy for if the agents are behind a firewall, or perhaps in some more secure environment to do trusted deploys (as an example). See the sections below to choose the type of agent that is most appropriate for your needs. 

Choosing which agent pipelines and steps run on

As you will see below, agents can be labelled. This means different part of your build, or pipeline, can be allocated to run in specific agents (based on their label). This can be useful for tools, operating systems or perhaps for security purposes (it is possible to set quite detailed access rules of what can run where, based on agent configurations). A server that runs an agent is often referred to as a "Node" in Jenkins terminology. 

Different ways of starting agents

Pick the right method depending on your environment and OS that master/agents run, or if you want the connection initiated from the master or from the agent end.

Have master launch agent via ssh

Jenkins has a built-in SSH client implementation that it can use to talk to remote sshd and start an agent. This is the most convenient and preferred method for Unix agents, which normally has sshd out-of-the-box. Click Manage Jenkins, then Manage Nodes, then click "New Node." In this set up, you'll supply the connection information (the agent host name, user name, and ssh credential). Note that the agent will need the master's public ssh key copied to ~/.ssh/authorized_keys. (This is a decent howto if you need ssh help). Jenkins will do the rest of the work by itself, including copying the binary needed for an agent, and starting/stopping agents. If your project has external dependencies (like a special ~/.m2/settings.xml, or a special version of java), you'll need to set that up yourself, though.  The Slave Setup Plugin may be of help.

This is the most convenient set up on Unix. However, if you are on Windows and you don't have ssh commands with cygwin for example, you can use a tool like PuTTY and PuTTYgen to generate your private and public pair of keys.

For connecting to Windows agents through cygwin sshd, see SSH agents and Cygwin for more details.

Have master launch agent on Windows

For Windows agents, Jenkins can use the remote management facility built into Windows 2000 or later (WMI+DCOM, to be more specific.) In this set up, you'll supply the username and the password of the user who has the administrative access to the system, and Jenkins will use that remotely create a Windows service and remotely start/stop them.

This is the most convenient set up on Windows, but does not allow you to run programs that require display interaction (such as GUI tests).

Note : Unlike other Node's configuration type, the Node's name is very important as it is taken as the node's address where to create the service !

Write your own script to launch Jenkins agents

If the above turn-key solutions do not provide flexibility necessary, you can write your own script to start an agent. You place this script on the master, and tell Jenkins to run this script whenever it needs to connect to an agent.

Typically, your script uses a remote program execution mechanism like SSH, or other similar means (on Windows, this could be done by the same protocols through cygwin or tools like psexec), but Jenkins doesn't really assume any specific method of connectivity.

What Jenkins expects from your script is that, in the end, it has to execute the agent program like java -jar agent.jar, on the right computer, and have its stdin/stdout connect to your script's stdin/stdout. For example, a script that does "ssh mynode java -jar ~/bin/agent.jar" would satisfy this.
(The point is that you let Jenkins run this command, as Jenkins uses this stdin/stdout as the communication channel to the agent. Because of this, running this manually from your shell will do you no good).

A copy of agent.jar can be downloaded from http://yourserver:port/jnlpJars/agent.jar . Many people write scripts in such a way that this 160K jar is downloaded during the running of said script, to ensure that a consistent version of agent.jar is always used. Such an approach eliminates the agent.jar updating issue discussed below. Note that the SSH Slaves plugin does this automatically, so agents configured using this plugin always use the correct agent.jar.

Updating slave.jar

Technically speaking, in this set up you should update agent.jar every time you upgrade Jenkins to a new version. However, in practice agent.jar changes infrequently enough that it's also practical not to update until you see a fatal problem in start-up.

Launching agents this way often requires an additional initial set up on agents (especially on Windows, where remote login mechanism is not available out of box), but the benefits of this approach is that when the connection goes bad, you can use Jenkins's web interface to re-establish the connection.

Launch agent via "JNLP" from agent back to master in a browser

Another way of doing this is to start an agent through Java Web Start (JNLP).

It requires the server to be configured to appear in first place. So, before attempting to create the build agent, head into manage Jenkins->Global Security->TCP port for JNLP agents.

In this approach, you'll interactively logon to the agent node, open a browser, and open the agent page. You'll be then presented with the JNLP launch icon. Upon clicking it, Java Web Start will kick in, and it launches an agent on the computer where the browser was running.

This mode is convenient when the master cannot initiate a connection to agents, such as when it runs outside a firewall while the rest of the agents are in the firewall. OTOH, if the machine with an agent goes down, the master has no way of re-launching it on its own.

On Windows, you can do this manually once, then from the launched JNLP agent, you can install it as a Windows service so that you don't need to interactively start the agent from then on.

If you need display interaction (e.g. for GUI tests) on Windows and you have a dedicated (virtual) test machine, this is a suitable option. Create a jenkins user account, enable auto-login, and put a shortcut to the JNLP file in the Startup items (after having trusted the agent's certificate). This allows one to run tests as a restricted user as well.

Note: If the master is running behind a reverse proxy or similar, you might need to configure "Tunnel connection through" in the "Advanced" section of the JNLP start method on the agent configuration page to make JNLP work.

Launch agent headlessly from agent back to master on command line

This launch mode uses a mechanism very similar to JNLP as described above, except that it runs without using GUI, making it convenient for an execution as a daemon on Unix. To do this, configure this agent to be a JNLP slave, take agent.jar as discussed above, and then from the agent, run a command like this:

$ java -jar agent.jar -jnlpUrl http://yourserver:port/computer/agent-name/slave-agent.jnlp

Make sure to replace "agent-name" with the name of your agent.

Other Requirements

Also note that the agents are a kind of a cluster, and operating a cluster (especially a large one or heterogeneous one) is always a non-trivial task. For example, you need to make sure that all agents have JDKs, Ant, CVS, and/or any other tools you need for builds. You need to make sure that agents are up and running, etc. Jenkins is not a clustering middleware, and therefore it doesn't make this any easier.  Nevertheless, one can use a server provisioning tool and a configuration management software to facilitate both aspects.

Node labels for agents

Labels are tags one can give an agent which allows it to differentiate itself from other nodes in Jenkins.

A few reasons why node labels are important:

  • Nodes might have certain tools associated with it. Labels could include different tools a given node supports.
  • Nodes may be in a multi-operating system build environment (e.g. Windows, Mac, and Linux agents within one Jenkins build system). There can be a label for the operating system of the node.
  • Nodes may be in geographically different locations which can be the case for multi-datacenter deployments. Jenkins can have agents in different datacenters when inter-datacenter communication is strictly regulated with edge firewalls. In this case, you might have a label for the datacenter or cloudstack in which the agent resides.

Defining labels

Labels are defined in the settings of static agents and for agent clouds. They must be space separated words which define that agent. Sticking to standard ASCII characters is recommended. Here's a few label suggestions one can use for agent agents:

  • For toolchains: jdk, node_js, ruby, etc
  • For operating systems: linux, windows, osx; or you can be more detailed like ubuntu16.04
  • For geographic locations: us-east, japan, eu-central etc
  • For platforms: docker, openstack, etc.

Using labels

Jobs and pipelines can be pinned to specific agents or groups of agents if multiple agents have similar sets of labels. In jobs, visit advanced settings and choose restrict where the job can run. In pipelines, you would restrict it with the node block. You can restrict jobs by specifying a single label or use a label expression. Here's two examples:

  • Single label: us-east
  • Label expression: openstack && us-east && linux

The above label expression means that a given agent must have all of those labels.

Example: Configuration on Unix

This section describes Kohsuke Kawaguchi's set up of Jenkins agents that he used to use inside Sun for his day job. His master Jenkins node ran on a SPARC Solaris box, and he had many SPARC Solaris agents, Opteron Linux agents, and a few Windows agents.

  • Each computer has an user called jenkins and a group called jenkins. All computers use the same UID and GID. (If you have access to NIS, this can be done more easily.) This is not a Jenkins requirement, but it makes the agent management easier.
  • On each computer, /var/jenkins directory is set as the home directory of user jenkins. Again, this is not a hard requirement, but having the same directory layout makes things easier to maintain.
  • All machines run sshd. Windows agents run cygwin sshd.
  • All machines have /usr/sbin/ntpdate installed, and synchronize clock regularly with the same NTP server.
  • Master's /var/jenkins have all the build tools beneath it --- a few versions of Ant, Maven, and JDKs. JDKs are native programs, so I have JDK copies for all the architectures I need. The directory structure looks like this:

    /var/jenkins
      +- .ssh
      +- bin
      |   +- agent  (more about this below)
      +- workspace (jenkins creates this file and store all data files inside)
      +- tools
          +- ant-1.5
          +- ant-1.6
          +- maven-1.0.2
          +- maven-2.0
          +- java-1.4 -> native/java-1.4 (symlink)
          +- java-1.5 -> native/java-1.5 (symlink)
          +- java-1.8 -> native/java-1.8 (symlink)
          +- native -> solaris-sparcv9 (symlink; different on each computer)
          +- solaris-sparcv9
          |   +- java-1.4
          |   +- java-1.5
          |   +- java-1.8
          +- linux-amd64
              +- java-1.4
              +- java-1.5
              +- java-1.8
  • Master's /var/jenkins/.ssh has private/public key and authorized_keys so that a master can execute programs on agents through ssh, by using public key authentication.
  • On master, I have a little shell script that uses rsync to synchronize master's /var/jenkins to agents (except /var/jenkins/workspace). I also use the script to replicate tools on all agents.
  • /var/jenkins/bin/launch-agent is a shell script that Jenkins uses to execute jobs remotely. This shell script sets up PATH and a few other things before launching agent.jar. Below is a very simple example script.

    #!/bin/bash
    
    JAVA_HOME=/opt/SUN/jdk1.8.0_152
    PATH=$PATH:$JAVA_HOME/bin
    export PATH
    java -jar /var/jenkins/bin/agent.jar
    
  • Finally all computers have other standard build tools like svn and cvs installed and available in PATH.

Note that in the more recent Jenkins packages, the default JENKINS_HOME (aka home directory for the 'jenkins' user on Linux machines, e.g. Red Hat, CentOS, Ubuntu) is set to /var/lib/jenkins.

Scheduling strategy

Some agents are faster, while others are slow. Some agents are closer (network wise) to a master, others are far away. So doing a good build distribution is a challenge. Currently, Jenkins employs the following strategy:

  1. If a project is configured to stick to one computer, that's always honored.
  2. Jenkins tries to build a project on the same computer that it was previously built.

If you have interesting ideas (or better yet, implementations), please let me know.

Node monitoring

Jenkins has a notion of a “node monitor” which can check the status of an agent for various conditions, displaying the results and optionally marking the agent offline accordingly. Jenkins bundles several, checking disk space in the workspace; disk space in the temporary partition; swap space; clock skew (compared to the master); and response time.

Plugins can add other monitors.

Offline status and retention strategy

Administrators can manually mark agents offline (with an optional published reason) or reconnect them.

Groovy scripts such as Monitor and Restart Offline Slaves can perform batch operations like this. There is also a CLI command to reconnect.

Then there is a background task which automatically reconnects agents that are thought to be back up. The behavior is configurable per agent (or per cloud, if using cloudy provisioning for agents) via a “retention strategy”, of which Jenkins bundles several (plugins can contribute others): always keep online if possible; drop offline when not in use; use a schedule; behave according to cloud’s notion of load.

Transition from master-only to master/agent

Typically, you start with a master-only installation and then much later you add agents as your projects grow. When you enable the master/agent mode, Jenkins automatically configures all your existing projects to stick to the master node. This is a precaution to avoid disturbing existing projects, since most likely you won't be able to configure agents correctly without trial and error. After you configure agents successfully, you need to individually configure projects to let them roam freely. This is tedious, but it allows you to work on one project at a time.

Projects that are newly created on master/agent-enabled Jenkins will be by default configured to roam freely.

Access an Internal CI Build Farm (Master + Agents) from the Public Internet

One might consider make the Jenkins master accessible on the public network (so that people can see it), while leaving the build agents within the firewall (typical reasons: cost and security) There are several ways to make it work:

  • Equip the master node with a network interface that's exposed to the public Internet (simple to do, but not recommended in general)
  • Allow port-forwarding from the master to your agents within the firewall. The port-forwarding should be restricted so that only the master with its known IP can connect to agents. With this set up in the firewall, as far as Jenkins is concerned it's as if the firewall doesn't exist.  If multiple hops are involved, you may wish to investigate how to do ssh "jump host" transparently using the ProxyCommand construct.  In fact,  with a properly configured "jump host" setup, even the master doesn't need to expose itself to the public Internet at all - as long as the organization's firewall allows port 22 traffic.
  • Use JNLP agents and have agents connect to the master, not the other way around. In this case it's the agents that initiates the connection, so it works correctly with the NAT firewall.

Note that in both cases, once the master is compromised, all your agents can be easily compromised (IOW, malicious master can execute arbitrary program on agents), so both set-up leaves much to be desired in terms of isolating security breach. Build Publisher Plugin provides another way of doing this, in more secure fashion.

Running Multiple Agents on the Same Machine

Using a well established virtualization infrastructure such as Kernel-based Virtual Machine (KVM), it is quite easy to run multiple agent instances on a single physical node.  Such instances can be running various Linux, *BSD UNIX, Solaris, Windows.  For Windows, one can have them installed as separate Windows services so they can start up on system startup. While the correct use of executors largely obviates the need for multiple agent instances on the same machine, there are some unique use cases to consider:

  • You want more configurability between the configured nodes. Say you have one node set to be used as much as possible, and the other node to be used only when needed.
  • You may have multiple Jenkins master installations building different things, and so this configuration would allow you to have agents for more than one master on the same box. That's right, with Jenkins you really can serve two masters.
  • You may wish to leverage the easiness of starting/stopping/replacing virtual machines, perhaps in conjunction with Jenkins plugins such as the Libvirt Slaves Plugin.
  • You wish to maximize your hardware investment and utilization, at the same time minimizing operating cost (e.g. utility expenses for running idling agents).

Follow these steps to get multiple agents working on the same Windows box:

  • Add the first agent node in Jenkins and give it its own working dir (e.g. jenkins-agent-a).
  • Go to the agent page from the agent box and launch by JNLP, then use the menu to install it as a service instead.
  • Once the service is running, you'll get jenkins-slave.exe and jenkins-slave.xml in your agent's work dir.
  • Bring up windows services and stop the Jenkins Slave service.
  • Open a shell prompt, cd into the agent work dir.
  • First run "jenkins-slave.exe uninstall" to uninstall the one that the jnlp-launched app installed. This should remove it from the service list.
  • Now edit jenkins-slave.xml. Modify the id and name values so that your multiple agents are distinct. I called mine jenkins-agent-a and Jenkins Agent A.
  • Run jenkins-slave.exe install and then check the Windows service list to ensure it is there. Start it up, and watch Jenkins to see if the agent instance becomes active.
  • Now repeat this process for a second agent, beginning with configuring the new node in the master config.

When you go to create the second node, it is nice to be able to copy an existing node, and copy the first node you setup. Then you just tweak the Remote FS Root and a couple other settings to make it distinct. When you are done you should have two (or more) Jenkins slave services in the list of Windows services.

Troubleshooting tips

Some interesting pages on issues (and resolutions) occurring when using Windows agents:

Some more general troubleshooting tips:

  1. Every time Jenkins launches a program locally/remotely, it prints out the command line to the log file. So when a remote execution fails, login to the computer that runs the master by using the same user account, and try to run the command from your shell. You tend to solve problems quickly in this way.
  2. Each agent has a log page showing the communication between the master and the agent agent. This log often shows error reports.
  3. If you use binary-unsafe remoting mechanism like telnet to launch an agent, add the -text option to agent.jar so that Jenkins avoids sending binary data over the network.
  4. When the same command runs outside Jenkins just fine, make sure you are testing it with the same user account as Jenkins runs under. In particular, if you run Jenkins master on Windows, consult How to get command prompt as the SYSTEM user.
  5. Feel free to send your trouble to one of our mailing lists

Windows agent service upgrades

If a newer version of the Jenkins windows service wrapper (jenkins-slave.exe) is available it will be replaced and used on the next start of the service. On very rare occasions the service wrapper may change its behaviour that would require a change in configuration of the service. This can not be done automatically as the service configuration may not be the default and as such could break an installation.

A quick fix of this is to uninstall the jenkins service then verify the service xml is up-to-date (and contains any site configuration such as the user credentials) and then re-install the service.

Other manual task that may fix the issue:

  • Jenkins > 1.565.1 - a message similar to Restart failure. 'C:\jenkins\jenkins-slave.exe restart' completed with 0 but I'm still alive in the agent error logs. In the windows service manager edit the service configuration to restart the service on failure and add -noReconnect to the agent arguments in the service xml configuration.

Other readings

48 Comments

  1. Anonymous

    You should consider expanding on the section about launching slaves via Java WebStart. Took me a bit to figure it out. I'll even write it up of you like.

    1. Yes, please! Much appreciated.

      1. Anonymous

        Can someone give me a hint please how to open the slave page (url) ?

        thx! 

        1. Anonymous

          On my master (Linux) node I have added an Ant instance which points to the /opt/ant-1.7.0 directory. Now, some build can be performed only on Windows so I've defined a Windows slave spawned via JNLP. But every build will fail, because Ant is not in /opt/ant-1.7.0 but somewhere else (c:\ant or whatever).

          Same question about JDK path.

          1. Anonymous

            Ok, I have found that if I put Ant into c:\opt\ant-1.7.0 it seems to work. Nevertheless I think that such things could be configurable per slave. Of course plugins could be able to contribute paths to slave configurations (wink)

        2. Anonymous

          If the Hudson master is running at

          http://hudsonmaster:8080/hudson
          

          then you would login to the remote slave server, open a browser and enter the above URL.  On the left-hand menu, you will see Build Executor Status section with "Master" and your remote slave listed below.  Click the slave name link and on the resulting page you will see the "Launch" button for Java Web Start.

  2. Unknown User (danp)

    Something very useful in corporate networks in the ability to run slaves as a windows service.  After a fair bit of playing I have been able to achieve this using the Tanuki software's Java service wrapper.  I am happy to write something up and send it through if it would be useful?

      1. Unknown User (danp)

        Done, sent through to Kohsuke's address (smile)

    1. Unknown User (jblack@gestalt-llc.com)

      Second that!

  3. Anonymous

    When hudson tries to launch a slave it complains that it cannot find maven-agent.jar I don't know what maven is. What do I need to do to make hudson happy?

  4. Anonymous

    Within a *nix system, you might be able to view top or uptime - looking for load average on a that host. Weighting it then scheduling work based on that value.

  5. Anonymous

    If I have 2 slaves build machines building the same project, is there a way to configure Hudson to utilize the build machines at the same time? for example, if machine 1 is already building and Hudson detects a change in the source code repository, can machine 2 start the build for the new checkin? That way there is no need to wait for machine 1 to finish to get feedback on the last checkin.

    1. Unknown User (t.guieu)

      I would appreciate this feature too !

      Is there a way to do that ? Or to manually start several builds of the same job ?

      1. That would indeed be a nice feature. As far as I can see there is no extension point yet to implement different scheduling strategies - maybe this could be introduced, and plug-ins could then handle features like the above...

  6. Unknown User (michaelm)

    An idea for a further rule for the scheduling strategy:

    4. If a build depends on another build, try to build it on the same node that previously build the parent build.

  7. Unknown User (leon_franzen@tvworks.com)

    Our organization uses Maven2. We deploy a master POM that nearly all projects directly or indirectly inherit from. The POM project is a job in Hudson. We intend to deploy the SNAPSHOT build when changes committed to the POM are picked up and when all downstream jobs pass. Does Hudson provide a mechanism for synchronizing successful slave artifact SNAPSHOT builds so that all downstream builds on different slaves use the CI-installed (as opposed to deployed) artifacts?

    Optimally I would like to do the following:
    1) Hudson job "master pom": mvn install
    2) Do all downstream jobs (triggered by Hudson)
    3) If step 2 successful perform snapshot deploy "master pom" to primary repository.
    4) Deploy downstream projects

    Or, because we are using various (identically configured) slaves to perform the jobs, do we have to install a Hudson dedicated repository and do the following?:
    1) Hudson job "master pom": mvn deploy to Hudson repository.
    2) Do all downstream jobs
    3) If step 2 successful, mvn deploy "master pom" to primary repository.
    4) Deploy downstream projects

  8. Is it possible to have a slave authenticate as a certain user? I've finally got a nice master/slave network up and running, but in order to do so, I had to grant read access to the "Anonymous" user on my main Hudson server, which opens up the site to anybody who wants to browse our projects, download build artifacts, etc. I would really prefer to have the anonymous user have no rights at all, and require usernames/passwords for all of our users, but then this would break our slaves...

    So, is it possible to tell the slave to log into hudson with a given username and password? I've looked through the documents here on the wiki, the config XML, and tried passing "-help" to all available programs, but I can't seem to find anything.

    1. I agree this is a defect (still exists in version 1.323); the whole authentication is less worthy when I must grant read access to Anonymous only to enable build slaves connecting to the master. Does there already exist an issue on it, or is it already planned for fixing in any further version?

      1. Unknown User (ntmatter)

        It looks like slave.jar accepts the following arguments: -jnlpCredentials USER:PASSWORD

        Providing Overall Read Access to the user seems sufficient to get a slave up and running. This means that you can run the slave with the following command:

        java -jar slave.jar -jnlpUrl http://build.example.com/computer/12.34.56.78/slave-agent.jnlp -jnlpCredentials builder:12345

        If you're running the Windows service, you can tweak the "arguments" node inside c:\hudson\hudson-slave.xml to contain this option. This does leave the issue of securely storing the password in the launch script, but it does achieve the "no rights for anonymous" objective.

  9. If you configure a Windows slave using Cygwin for sshd, I recommend not using the CVS client that's part of Cygwin. I noticed that it was munging CRLF line terminations on DOS format files. It's possible that some combination of settings could avoid the problem, but I decided to uninstall Cygwin CVS and install TortoiseCVS (with CVSNT) instead. Once CVSNT is added to the PATH, everything worked perfectly.

  10. Unknown User (homeryau@yahoo.com)

    Thanks for the writeup on the master/slave setup.

  11. Unknown User (chrishines)

    I have a working Master (Linux) / Slave (Windows XP) setup.  I use the WMI interface to launch the slave.

    Getting the master to successfully connect to the slave and launch Hudson remotely required some configuration changes on the Windows machine that were not documented here.  The exception message returned during the initial failed attepts provided just enough information for me to find this useful page on the J-Integra site that solved my problem.  Maybe others will find this information useful too.

  12. Unknown User (a.sheilly@gmail.com)

    All the posts seem to indicate that the Master has to be a Linux machine. Can Windows (Windows XP) be used as a Master? I wanted to have windows XP as master that would trigger builds on slaves (windows machines again). Is that possible? Where can I find detail instructions on this one?

    1. I'm using Jenkins on 2 Windows7 machines, ie., 1 master and 1 slave. The information provided above sufficed to set everything up. As soon as I provided access to the slave, the setup was done automatically and was really easy.

  13. Unknown User (saniyachopra@gmail.com)

    M using Linux master and Windows slave. I used JNLP to launch the slave on Windows. When I used the services.msc command this opened services window and from there I tried to start HudsonSlave service and there it gave the following error

             Could not start the HudsonSlave service on Local Computer

             Error1053: The service did not respond to the start or control request in a timely fashion.

    Plz help me solve this error

  14. Unknown User (prashanthwge@gmail.com)

    When I use the windows 2003 Master and windows 2003 slave I am having a issue while running the build on slave, it fails with (Fatal : Unable to build script).  I think it is adding an extra slashes \, how to eradicate this without this it is not working. Started by user anonymous
    Building remotely on testing1
    DIMENSIONS Removing 'file:/C:/Hudson/workspace/PROJ1_DEV1/'...
    DIMENSIONS Checking out project "Test_DEV:PROJ1_DEV1"...
    DIMENSIONS (Note: Dimensions command output was -

    DIMENSIONS SUCCESS: Operation completed
    DIMENSIONS Operation completed
    DIMENSIONS )
    DIMENSIONS Dimensions project was successfully locked
    FATAL: Unable to find build script at C:\Hudson\workspace\PROJ1_DEV1\\proj1\build\build.xml
    DIMENSIONS Dimensions project was successfully unlocked
    Finished: FAILURE

  15. I am using Hudson to launch a distributed build for automated test purposes.  The master Hudson server is a Linux box; the slave, which only runs this set of tests, is a Windows box.  We use ant on the Windows box to launch the automated tests.  The slave is set up using JNLP and autologon.  The process works fine; the only question is that sometimes in the error logs I will find that ant returned a non-zero exit code from the automated test process (the exit codes are for the automated tests, for example, informing us that exceptions occurred during the automated tests) on the slave machine.  This is printed in the console output for the build, but the build still succeeds.  I'd like to be able to use that exit code to send descriptive email, but I can't seem to find any way to access that information.  Am I missing something?

  16. Are there plans to add another distribution build like:

    1. the hudson master will get the source code changes from the SCM

    2. rsync this with a slave node

    3. finally builds it on the slave node

    Im asking because, i'm using Synergy as SCM and a Synergy Project can only exists once. So if a build runs initially on node 1 and next time on node 2, synergy is moving the complete project to node 2.

  17. Unknown User (meenu)

    I am working on distributed builds from hudson. One window NT node is being used as slave. I am trying to perform build on mounted drive on window node. But hudson does not understand the drive names as say U:\ or any other name. But it recognises the absolute path.

    My requierement is to use the network drive with out giving absolute path.

    Please guide if we can perform this functionality from hudson

    1. Unknown User (alea)

      We managed to get this working by adding a subst command to the build

      subst U: C:\mydir

      The service should then be able to see the U: drive. You may also need to configure the Hudson slave to run as a process with network access rights (not sure whether this is strictly necessary).

  18. Unknown User (norbas)

    Lets assume that we have Master M and slave A, B and C.

    How can we execute on demand the Job Z, only in one of the slaves?

    For example: I want to run Job Z on Slave C. and later I want to run Job Z in Slave B.

    Cheers

    1. Unknown User (arya.ahmadi-ardakani@wdc.com)

      goto Hudson, Select the job Z, click on configure. at the job configure page click on "Restrict where this project can be run" and in the "label expression" input box enter the name of the slave (ex: salve A). and then save this job.

      create the same job (job Z: job Z-1, Z-2) for other slave (ex: slave B and C) however set the Restrict where this project can be run" to slaves B and C.

      I think you get the idea from here

  19. Unknown User (arya.ahmadi-ardakani@wdc.com)

    I was wondering once the build is done (using an script that calls gcc and make and all sorts of thing) on an slave, how can I use those files to package them?
    example: I have 3 builds that are being run on 3 different salves (Slaves A, B, C) and the resultant of all three needs to be packaged as one. how does master handle this situation?

    Please let me know.

    Thannk you

    1. Have you looked at the copyartifact plugin?  You could have each job archive its relevant files and then trigger a downstream job (say D) which uses the copyartifact plugin to get the archived files from each of the jobs (A, B, C).  It could then package them together.

      Job D would have to specify to wait for upstream jobs to finish building before it runs.

  20. One important item I noted when starting a Windows Slave via WMI+DCOM, you have to have "java" in your PATH on the Windows slave. Otherwise it will fail to start the slave.

    This is actually a somewhat puzzling behavior because it seems that the Jenkins code - based on the messages during setup - actually looks for Java.

  21. About the marking slaves as online/offline: it will be good to add the possibility to view who has changed the node status (reserve it for example) if the 'Matrix-based security' is used. Is this possible?

  22. I have some slaves that are faster machines and some slaves that are slower.  I would like jobs to have a priority to run on the faster machines but fallback to the slower machines when the fast ones are busy.  I haven't found a good way to do this through the 'Restrict where this project can be run' feature of the job.  Any suggestions about how to make this work?

    1. I have the same problem. The way I would like to work is that Jenkins sorts all the slaves in my order of preference, and then chose the first available one. In case few were set with the same preference, then it can prefer one with the most recent build.

      This can be applied even to the current scheme of preferences, chose any prefered free node, and only if none available then chose one maked to be used only for tied jobs.

      The idea of saving disk space by reusing the slave that ran the last build is nice, but I dont think this should override my setting that a certain machine should be used only for tied jobs.

      BTW, this is my first comment, and I cannot leave before saying big thanks to all involved with the Jenkins project!

  23. Hi, the article is so wonderful, I am interested in it. I will pay attention to your articles. And I like cheap clothes very much, and I have found a wholesale in china online, there are cheap shoes on their website. 

    Especially the cheap clothing and cheap bags, the wholesale shoes and wholesale jewelry are also very nice, they are my favorite!

  24. Do you like motorcycling and have your own motor equiments?You can come here Belstaff Outlet to find your Belstaff Jacket.Belstaff Coat can not little.If your foot is cold,Belstaff Boots is not bad.

    You can buy a Belstaff Bag to hold those equipments.

  25. Scheduling strategy - we have 4 slaves, all identical, all the same network distance from the master.

    Each slave is configured to have 2 executors.

    We've noticed that Jenkins always seems to favour one slave in particular, to the extent that it will run 2 jobs on it simultaneously even when all the other slaves are idle.

    This is not ideal so I reduced the executors on that node to 1.  Now it does the same behaviour, but preferring a different node.

    I'd prefer if it took account of the current job situation (or recent average CPU load?) when allocating a new job as well.

    This is open as JENKINS-7444

  26. I have seen no where a reference to working with distributed builds and maintaining Maven snapshots.

    In a master-only configuration, we used to install the snapshots to local maven repository, which could be used by other builds.

    However, with a master/slave configuration, two builds might be processed on different machines, so the local repositories are not in sync, which means build problems.

    Is there anyway to overcome this issue other that deploying every dependency to our organization repository (Artifactory) and building every project with force update snapshots? (mvn -U)?

    Thanks

    Daniel

  27. With Jenkins able to do autoinstall of tools, do we need to follow the Unix guidelines of putting tools in /var/tools. I mean, sure, non-standard tools, yes. The examples of ant, maven and the JDK seem moot now, or am I mistaken?

  28. >Jenkins tries to move long builds to slaves, because the amount of network interaction between a master and a slave tends to be logarithmic to the duration of a build

    Please explain this sentence more clearly. Now it states the following )as I understand):

    Jenkins tries to move long builds to slaves, because it takes more traffic between servers - which is very strange. I would understand if Jenkins tries to minimize traffic and thus tries NOT to move long builds to slaves.

  29. "Restrict where this project can be run" options: I wonder, what is the difference between expr&&expr and expr||expr variants?

  30. slave.jar should update itself. This is a question / source of frustration for many people.

  31. I have been reading the document and wondering why scheduling can't be random ?

     - Jenkins tries to build a project on the same computer that it was previously built.


    I feel it should be random as you mentioned that some agents are slow and others are faster, while some are closer and other far.

    I was wondering about Asynchronous functionalities and tests and If it is chosen randomly then It gives me much greater confidence that software works in different environment.