Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up new Jenkins slave

Tags:

I recently inherited a Jenkins-driven Java project where the primary developer just upped and quit. He had deployed the Jenkins WAR to a Tomcat instance on a virtual server, and that is what was considered to be the "build server".

This build server had a slave configured for building and deploying to myserver.example.com, another virtual server. Over the weekend, the systems staff retired the physical server that the myserver.example.com virtual lived on, producing the following exception for any Jenkins job configured to deploy to that slave:

enter image description here

When I click on the "See log for more details" link I see the following console output:

[03/18/13 08:13:31] [SSH] Opening SSH connection to myserver.example.com:22. java.io.IOException: There was a problem while connecting to myserver.example.com:22     at com.trilead.ssh2.Connection.connect(Connection.java:755)     at com.trilead.ssh2.Connection.connect(Connection.java:546)     at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:650)     at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:283)     at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:200)     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)     at java.util.concurrent.FutureTask.run(FutureTask.java:138)     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)     at java.lang.Thread.run(Thread.java:662) Caused by: java.net.NoRouteToHostException: No route to host     at java.net.PlainSocketImpl.socketConnect(Native Method)     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)     at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)     at java.net.Socket.connect(Socket.java:529)     at com.trilead.ssh2.transport.TransportManager.establishConnection(TransportManager.java:342)     at com.trilead.ssh2.transport.TransportManager.initialize(TransportManager.java:450)     at com.trilead.ssh2.Connection.connect(Connection.java:699) ... 9 more [03/18/13 08:13:34] [SSH] Connection closed. 

This makes sense, since the slave (the myserver.example.com virtual) is offline. However, having no real previous experience with Jenkins, I'm not sure of what the proper steps are for configuring the Jenkins master to build/deploy these jobs to a new slave, and how to set up the new slave. For instance, do I need to install anything on the new slave, or do any kind of setup/config? Thanks in advance!

like image 453
IAmYourFaja Avatar asked Mar 18 '13 12:03

IAmYourFaja


People also ask

How set Jenkins Windows slave?

To set-up the Windows-slave agent:Go to Manage Jenkins -> Manage Nodes ->click on New Node -> Enter the node name -> Select permanent agent. Enter a sample description and the no of executors (ie. no of jobs you want to run parallely on windows),here I have given 1 executor.


1 Answers

Adding a slave in Jenkins is pretty simple. Basically, if you are using a unix slave, you need SSH access to the machine. You also need to have the Jenkins SSH Slaves plugin installed. Once you have that, go to the Manage Jenkins option on your Master and choose Manage Nodes.

The steps are then:

  1. Click New Node
  2. Select Dumb Slave and give it a name (symbolic, doesn't need to be the domain name, that comes later)
  3. Click OK and proceed to the configuration page
  4. Fill in the # of executors with the number of simultaneous processes you want to run on that node (usually not more than the number of allocated CPU cores)
  5. Fill in the Remote FS Root with the full path to where you want Jenkins to store its working files
  6. Optionally add Labels if you are using those in your system (not necessary in many cases, but your Projects may require nodes have certain labels to be in the pool of executors for specific jobs)
  7. Select Launch slave agents on Unix machines via SSH under Launch Method (if not already selected)
  8. Put the fully-qualified domain name in the Host field which appears under the Launch Method line

There are some assumptions about the tools that are installed on the slave. If you have specialized tools, you may need to install them separately (or look at plugins that handle moving tools over immediately prior to execution). However, if your nodes are built off of a template which has all of your build tools on them (java, ant, etc in your case probably), then this will be all you need to do to get things going.

like image 192
gaige Avatar answered Sep 30 '22 19:09

gaige