Why Jenkins Slave need java to run slave.jar? - jenkins

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)?

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.

Related

Jenkins slave is going offline

I have Jenkins slaves connected with master and after some intervals my Jenkins slave is going to offline and whenever its going to offline I am manually running the Jnlp command(Run from slave command line:
java -jar slave.jar -jnlpUrl http://abc.ap.com:8080/computer/Wkaakkaak/slave-agent.jnlp -secret af95sdsda051229eb57b1d51202e5cf986a1cbcfbb2e0a5130d915ba037297a0 ) in slave machine to connect with master but every time I can't login to slave and run the command.Is there any way to run my Jenkins slave automatically.I have configured slave and the Launch method is launch slave agents via java web start.Don't know how to resolve the issue.Could any one please help me out on this? My Jenkins version is 1.585.

Jenkins: how to run an exe on a remote computer

I just started using Jenkins. Still not familiar with all its features.
I would like to run a Ranorex test which is on a remote computer. How can I do that from Jenkins?
To execute binaries on a specific host, you can use slaves.
Here is a guide to setup master and slave on windows:f
https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines+on+Windows
You will run the slave on the remote computer and connect it to the master.
To run the slave on your remote computer, you have to download the slave.jar and start it on the remote computer. This is described in the wiki article above.
You have to ensure, that your job is executed on the slave. This can be done by labels. You configure a label on the slave and configure the same label on the job too.

Jenkins - How to build a master job in slave machine?

Initially, I configured the master and slave connection setup in windows machine by launching Java web start method. And then Created a Job in Master machine. Now my question is how to assign a master job to slave machine to build the job. Please provide me the steps to follows. Thanks you.
And please let me know is slave machine requires master machine URL for Connecting Master Slave Connection setup?
You can tie your job on whichever slave you want.
There is option of "Restrict where this project can be run", You can provide jenkins slave name on which this job should always run.
Answer to your last doubt. There is standard methods to connect slave to master, it depends how are you connecting the slave to master.

Jenkins Master/Slave configuration

I've been reading about Jenkins master/slave configurations but I still have some questions:
Is it so that the slave Jenkins is not actually installed and started up the way master Jenkins is? I assumed I would install one master Jenkins and another slave Jenkins in the same way, and then master Jenkins would control the slave e.g. through SSH? So I cannot view the slave Jenkins through a GUI?
The reason why I have thought about adding a slave Jenkins on another VM is because the VM contains our application servers (many test environments). Deploying and starting/stopping application servers from master Jenkins is a pain because master Jenkins and application servers are on different machines. Therefore, if I would add a slave Jenkins to the machine where our application servers are, these would actually be deployed and started/stopped locally (by slave Jenkins). I wonder if I have missed something, of if my presumptions are still valid.
In a standard Jenkins master/slave setup, Jenkins is only installed on the master. That is where you see the user interface and start/configure build jobs.
The slaves execute the jobs. There is no Jenkins installation here other than a small Java app to have Jenkins communicate to/from the slave. Jenkins talks to these slaves through the slave.jar app over e.g. SSH via the SSH Slaves Plugin and can monitor if the slave is running, etc.
So in your case, you can start jobs from the master that will execute on the application servers.
The master/slave setup also allows you to host all whole bunch of different slaves, with different OSes, different hardware, etc. You can communicate job results (artifacts) from one slave to another via the Copy Artifacts Plugin.
There are also ways to duplicate the actual Jenkins master with load balancing in a heavy use scenario. That is not what you seem to be looking for.

Jenkins building on a remote machine

I can only build my system on a FreeBSD 5 machine.
I am looking and introducing gerrit and Jenkins into my team.
I have setup the server running gerrit and Jenkins both on a Debian machine for now.
What is the standard way of dealing with Jenkins building on a remote server?
The standard way would be to install a Jenkins Slave on the remote server. See https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
You then setup the job that must be built on a FreeBSD 5 machine, to only only run on that slave/node. This is can be achieved within the job configuration by specifying the FreeBSD machine by name.
If you don't want other Jenkin jobs to run on that FreeBSD machine, you can configure the slave to only run jobs that are tied to it. See step 4 in the JENKINS Step by step guide to setup master and slave machines for the config page that you need to do this.

Resources