Launching Jenkins Slaves on the fly.

Jenkins Master-Slave Architecture

Jenkins is a awesome Continuous Integration tool which allow you to add multiple slaves as per your project requirement . Working in the distributed environment, we need different machine for different purpose. We might need Ubuntu machines to do specific tasks, CentOS machines to perform additional task and so on.

While thinking Continuous Integration in cross-browser and cross-platform environment, you must have master slave architecture of Jenkins. You have master mode and millions of slaves running under it (not millions though :) ). You can read more about adding multiple slaves here.

Let’s say your master node is running on http://master-yourawesomedomain: 8080

Next step is to add few machines as a slave in the same data center. You must have to make sure that your master can ssh into slave machine.

Try this

<span class="GRcorrect">ssh</span> user@master-yourawesomedomain.com

Now you are logged into Master node

Tyr ssh into slave machine eg we have 2 slaves

1] slave-01.yourawesomedomain.com

2] slave-02.yourawesomedomain.com

you@master-yourawesomedomain$ ssh user@slave-01.yourawesomedomain.com

You should add your private key to known host and you will be able to access slave machine.

Let’s see how you can do from Jenkins Master interface.

 Add Node

Login to your Master Jenkins http://master-yourawesomedomain: 8080 with your Username and Password.

Click on ‘Manage Jenkins’ → Manage Nodes

You will see a screen something like this:

AddNode

Now Click on ‘New Node’ and fill in the details like this :

addnodes

 

 Configure Node

Next thing is you have to configure your slave as per your requirement.

Few things to note:

  • # of executor: You shouls put it to 1 or 2
  • Remote FS root : Better to have jenkins directory as /var/jenkins
  • Host : This must be a ip address of your slave machine
  • Username : you must run all your tests as a jenkins_user
  • Password : you can use password but I would prefer private key. It’s upto you and your companies security policy.Once you happy save the config.

You will see window to launch new slave like this:

slaveconfig

Launch Node

Click on the Launch Slave and You have new machine to run your tests. !

launchsklave

 

All Done. You got new slave to run tests on Jenkins.

Happy CI !!

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>