Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run build of Machine A from Machine B using Jenkins

I have 2 computers. Com-A, Com-B.

I have build automation functional script using selenium webdriver,Testng and maven on Com-A.

Com-A has installed everything with Jenkins but Com-B has only jenkins , Can I run build which is deployed in Com-A from Com-B? Or I will have to install all necessary software to Com-B also?

like image 938
Helping Hands Avatar asked May 13 '16 08:05

Helping Hands


3 Answers

Your current setup is good enough to kick off the build remotely from Com-B to Com-A.

Please make sure the jenkins server deployed on Com-B has properly configured as Master and other nodes (ex : Com-A) as slaves.

To ensure the configurations, please follow the steps given below :

  • Step 1: Go to Manage Jenkins page and select Manage Nodes link

    Manage Jenkins

  • Step 2: On Manage Node page, you can see a list of nodes if already configured. Else there will be only one node named as Master by default which represents the host.

Manage Nodes

  • Step 3: To add new Node, give a name (ex: selenium-slave1) and select Dump Slave option to add a node as customized slave.

Add New Node

  • Step 4(a): After adding the node, configure the node as shown below.

    Configure New Node

  • Step 4(b): Make sure while setting the Launch Method field, Launch slave agents on Unix machines via ssh has been selected (this will communicate via ssh between master and slave nodes).

enter image description here

  • Step 4(c): configure advanced fields which are highlighted as per your settings and click save.

Advance Configuration of new Node

  • Step 5: Finally a new node has been added as slave and configured successfully.

Node Configuration Successful

  • Step 6(a): Now Configure a new Job to schedule it whenever it need to be run.

Add a New Job

  • Step 6(b): Add a new maven job since your project has been configured using maven.

enter image description here

Note : Will add the job config soon.

like image 131
S.K. Venkat Avatar answered Sep 28 '22 08:09

S.K. Venkat


You can make Com-A a slave machine in jenkins. Com-B will become master and mark the build to always run from Com-A node.

Refer https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines

like image 31
niharika_neo Avatar answered Sep 28 '22 07:09

niharika_neo


First of all, u don't need to install all thing in COM B.

Connect with COM A with ssh(secure shell) command and than execute ur project using shell or bash script. In jenkins, u will found all build step under Build option.

i use the below command to run my project using shell script:

ssh -l user comAIpaddress(ex. 192.192.192.192) sh SciptLocationInComA.shell

this command first connect with another machine and than execute the shell script to run the project.

Run a java project using shell or bash script is quite easy..... :)

like image 21
noor Avatar answered Sep 28 '22 07:09

noor