How to Configure Jenkins and Create a Node

Jenkins Configuration
  • Prerequisite: Jenkins installation is completed. If you have not setup your Jenkins yet, refer the steps here.
  • Click on Manage Jenkins from the left pane
  • Next click on Global Tool Configuration
  • Under Global Tool Configuration, click on JDK installations, uncheck the install automatically checkbox and enter the Name as JDK and JAVA_HOME as the directory at which you have installed the JDK

  • Scroll down, click on Maven installations and similarly enter the Maven Name and MAVEN_HOME values
  • Click Apply or Save
  • Go back to Manage Jenkins and click on "Configure System"
  • Scroll down to E-mail Notification and click Advanced
  • Go to the Gmail account you wish to use for sending emails from Jenkins, turn on the 2 step verification (if you don't have it on already) and generate an app-specific password for Jenkins.
  • Enter the SMTP server and check Use SMTP Authentication. Enter the email address, password, SMTP Port and enable Use SSL as shown in the screenshot below.
  • Test your configuration by checking "Test configuration by sending test e-mail" and by sending a test email to any of your email address.
  • Click Apply or Save

Jenkin Node

Normally, Jenkins node is used to create a Master-Slave architecture which helps you distribute the load on the Jenkins Master to multiple Slave nodes. 
But you can create the nodes on the master machine itself and run your jobs on these nodes instead of the master node for two reasons.
  1. If your Jenkins is running as a service and your Jenkins job is trying to run a browser-based test, your test won't be able to instantiate chrome and will fail with error "unknown error: Chrome failed to start: exited abnormally" or "Process unexpectedly closed with status: 1" if you are using Firefox. Running your Job on a node will solve this problem.
  2. You can restrict the # of executors of each Node and have your Jenkins jobs restricted to run on a particular Node to help you better handle the jobs parallel execution and priority. 

Creating a Node
  • Click on Manage Jenkins from the left pane and click "Configure Global Security"
  • Scroll down to "Agents" and select "Random" for TCP port for JNLP agents

  • Go back to Manage Jenkins and click "Manage Nodes"
  • Click New Node from the left pane, Enter a node name of your choice, select Permanent Agent and click OK


  • On the next page, enter the Remote root directory, Labels of your choice and select "Launch agent via Java Web Start" under Launch method and click Save.

  • On the next screen, you will see the Node listed with a cross icon which means to the node is created but not yet connected.

  • Clicking on the Node name and you will see two options to connect the node agent. 


  • Download agent.jar file by clicking on the agent.jar link under "Run from agent command line" option and copy the complete command and run it from the terminal. Make sure you are running the command from the directory path where you have saved your agent.jar file. You can also create a .sh file with this command to help you run this everytime you need to start the node. You will the Info as "Connected" when you run the command.
  • Go back to your Jenkins -> Manage Jenkins -> Nodes and you should now see that the cross icon has disappeared and your node is now connected.









Comments

Popular posts from this blog

Get rid of "Timed out receiving message from renderer"

Setup Selenium Grid using Kubernetes

Launching Selenium Grid and Registering a Web Node