Jenkins – Distributed Builds
If you have larger and heavier projects which get built on a regular basis and running all of these builds on a central machine may not be the best option. In such case, you can configure other Jenkins machines to be slave machines to take the load off the master Jenkins server.
Sometimes you might also need several different environments to test your builds, in this scenario using a slave to represent each of your required environments is good idea.
The master-slave architecture of Jenkins is used for distributed build environments, where the workload of building projects is distributed to multiple agent nodes or slaves. We can also different environments for each build.
Since each slave runs a separate program called a slave agent, there is no require to install the full Jenkins (package or compiled binaries) on a slave. There are a variety of ways to start slave agents, but at the end of the slave agent a Jenkins master needs to establish a bi-directional communication link (for example a TCP/IP socket) in order to operate.
To set up the slaves/nodes in Jenkins, use the following steps:
Step 1: Go to Manage Jenkins.
Step 2: Scroll down and select Manage Nodes.
Step 3: Click on New Node.
Step 4: Give a name for the new node, choose Permanent Agent option and then click OK.
Step 5: Enter the other details of the new node:
- Remote root directory: Path of the root directory
- Labels: give any label
- Usage: select use this node as much as possible
- Launch Method: There are following four methods –
Here, I will use “Let Jenkins Control this Windows slave as a Windows service”. When we select this option, you need to enter the following information:
- Administrator user name: Enter the user name of the node machine
- Password: Enter the password of the node machine
- Host: Enter the host IP
- Run service as
Step 6: Once you entered the above information, the new node machine will initially be in an offline state, but will online if all the settings in the previous screen were entered correctly.