Adding Slave Jenkins to Master Jenkins
Jenkins is an orchestration tool that you can use it for general automated jobs. Using one Jenkins for every kinds of job create some inefficiencies so the better idea is grouping jobs for their functionalities and having them done with slave Jenkins. Each slaves can be attached to master as a node and waiting for command. With this way you can run Windows related jobs in Windows; unix or mac related jobs by unix system and so on. Moreover you can add multiple and exactly same slaves so that to run the jobs more quickly. In this post I want to share an idea for adding slaves to master Jenkins.
1. Go to master Jenkins > Nodes > New Nodes >
- Enter "Web Automation Slave 1"
- Select "Permanent Agent"
- Click "OK"
- Enter Labels > "regression"
- Click "OK"
- Click "Web Automation Slave 1"
- Copy the URL of this page
2. Go to slave Jenkins Machine
- Browse the URL copied from master jenkins
- Click slave.jar link to download slave jar file
- Open a terminal / CMD / PowerShell run the command "java -jar slave.jar ..."
3. Create a new job to use slave Jenkins, in the configuration of the job
- Select "Restrict where this project can be run"
- Enter "run_on_slave_1" to "Label Expression" field
- Enter the other fields and click "Save" button
4. Run the job on master Jenkins
- see that the job building remotely on slave Jenkins.