2

Via SSH slave plugin, we can have Jenkins slave to run specific job, but in my understanding, only SSH is enough to execute commands, why Jenkins still want to run slave.jar(Have to install JAVA)?

zhangyuting
  • 68
  • 1
  • 5
  • SSH is _one_ of the remote execution mechanism Jenkins support. Jenkins own functionality is in slave.jar. – Jayan Apr 17 '16 at 04:20

1 Answers1

4

SSH is the communication mechanism between the master and slave machines.

The slave still has to run something to listen to the master and to do the actual builds. That Jenkins slave code is written in Java and stored in slave.jar.

So the reason you need Java on the slave machine is because the Jenkins slave software is written in Java. SSH is used by the master to tell the slave to do something.

Dave C
  • 1,572
  • 4
  • 23
  • 34
  • Thanks for the answer. But I still think that only ssh is enough to execute command and get output and exit code. Why Slave.jar is needed for job execution. – zhangyuting Apr 24 '16 at 10:12
  • ssh is great for communicating with the slave machine -- but it only can tell the remote machine what to do. That "what to do" is to run java and use slave.jar. ssh can report the output of slave.jar. But the smarts to run the jenkins slave is in slave.jar. What you're thinking of is another way it *could* have been implemented, and that is the master could have sent lots of commands to the remote machine using ssh. But in fact, in order to reduce the amount of work the master has to do, it uses ssh to fire off a single command to the remote machine: run slave.jar to do the rest. – Dave C Apr 25 '16 at 20:17
  • Thanks Dave, that make senses. – zhangyuting Feb 15 '17 at 03:26