Thursday 31 August 2017

Easy Way To Add Node To Jenkins

ad300
Advertisement
The method explained below probably the easiest way of adding the Node to the Jenkins, at-least I found it very straight forward and simple to understand.

So let's begin adding the Nodes to the Jenkins


Add Node To Jenkins



  1. Open Jenkins, Navigate to Manage Jenkins ⥤ Configure Global Security, Select "Random" for "TCP port for JNLP agents", Save the changes. This is required as we are going to connect and Launch the node using "Launch Java via Java Web Start". Now, this is one-time Configuration and needed only if there is no Node attached to your Jenkins before. No need to do this step if you have already a Node connected using "Launch Java via Java Web Start" method.
  2. Navigate to Manage Jenkins ⥤ Manage Node, click Manage Node. You can see the Master Node added by default to the Jenkins, The execution happens on the Master Node if there is no Node added to the Jenkins. Click "New Node" link on the left-hand side.
  3. Enter the Node name (Actual name of the VM ), select "Permanent Agent" and Click ok.
  4. Keeps all the values default and click Save. You can observe value selected for Launch Method on this page. "Launch Agent via Java Web Start", Will be seen only if you Selected Random for "TCP port for JNLP agents" on Configure Global Security page.
  5. Once new node is added it will appear offline as shown below. 
  6. Click on the Node now. Node Page will be opened. Now there are 2 ways to connect the Node to the Jenkins. 1. Launch agent from browser and 2. Run from agent command Line. I would suggest taking the 2nd option.
  7. For running the agent from the command line you need to download the "slave.jar". If you observe carefully on your page there is a slave.jar link provided in the command written. Click that and it will download the jar for you.
  8. Now login to your remote machine that you have added as a Node to the Jenkins, Create a folder "NodeLauncher" in your C Drive. Copy the Slave.jar that you have downloaded to this folder.
  9. In the folder right click and create a new Text Document, Now copy the below command from you Jenkins Node page: 
  10. Paste it into the new text document created, and add one more line mentioned below to this document. "netsh advfirewall firewall set rule group="remote desktop" new enable=Yes"
  11. Your new text file should look like below:
  12. Save the test file as slaveLauncher.bat
  13. You should have 2 files in your NodeLauncher Folder.
  14. Double click slaveLauncher.bat, it will initiate the launch and connect the Node to the Jenkins.
  15. If you will go back to Jenkins and see, the Node will no longer be offline.

Hope you will find this document useful, Please write to me your doubts and issues.




Share This
Previous Post
Next Post

Welcome to my blog, I am Subhash Junas, I have been working on Core Java, Ruby, Selenium, Cucumber and on various automation technologies from past couple of years. I love to work on new challenges, solving problems and obstacles.

0 comments: