How do I set up a windows slave agent via JNLP If I have a Jenkins master configured on linux

0 votes
I have a Jenkins master configured on Linux platform (ubuntu 18.04 virtual machine) and I need to configure a Windows-slave agent via java web start. How do I set up the node,and launch it?
Jun 3, 2019 in Jenkins by Sam
• 6,260 points
58,108 views

1 answer to this question.

0 votes

JNLP(JAVA NETWORK LAUNCH PROTOCOL) is used to Connect to/launch your java application( here Jenkins) from a remote location.

In order to setup a windows-slave agent you need to first Enable the JNLP Agents :

  • Go to Manage Jenkins -> Configure Global Security -> under Agents section -> TCP port for inbound agents -> select Random ->Save.

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.

  • Also specify the remote root directory which will act as the default jenkins workspace on the slave agent (F:\jenkins_remotedirectory is my remote root workspace on windows).

  • Give a label and for launch method ->select  launch agent by Connecting it to the master since we are configuring a windows slave (launch agents via ssh is for linux machines).

  • Click on Save

  • We have configured the slave machine but haven't launched the agent yet. 

  • In order to run any jenkins job on the master we had installed certain dependencies like Git (for source code management), JDK and Maven (for building the jobs). 

  • Similarly we need to download and install those dependency tools on our windows-slave (including setting the environment variables for JAVA_HOME and MAVEN_HOME).Test whether the tools are aptly configured and installed and mention the tool locations by specifying their paths in the windows-slave machine.

  • Next step is to connect the slave agent with the master. You can either do this by clicking on the launch button or you can do it via command line by executing the command that is mentioned.

  • Here I decide to launch the connection via command line.For this I have to first download the agent.jar file and paste it in my remote root directory that I have specified as workspace for windows-slave(F:/jenkins_remotedirectory). And then from the remote root directory in command prompt  of my slave agent I need to run the specified command.

  • NOTE: The IP address of the jenkins master could be some random IP. You need to specify the IP of your machine on which Jenkins master is configured.


     
  • Now the widows-slave is successfully configured and launched as shown below:




     
  • The widows-slave agent is now functional and the master can delegate any job to the slave agent node.
answered Jun 3, 2019 by Sirajul
• 59,230 points

I have configured windows slave agent via launch agent by Connecting it to the master. I am facing the below error when I am trying to run the following command which is copied form the Agent Node page 

java.net.connect Exception

java -jar agent.jar -jnlpUrl http://10.201.64.144/computer/Agent_Node_1/slave-agent.jnlp -workDir "E:\Jenkins"

Can you please help on this?

Hey @Muthu There could be some random IP for jenkins master. You need to specify the IP of your machine on which Jenkins master is configured. Check if you have given the correct IP.
Could it be that you’ve omitted the parameter: “-secret <secret_key>“ ?

I have had issues as well running that command. The fix is to take out the quotes out for the -workDir argument. So your command should just be 

java -jar agent.jar -jnlpUrl http://10.201.64.144/computer/Agent_Node_1/slave-agent.jnlp -workDir E:\Jenkins

Related Questions In Jenkins

0 votes
1 answer

I’m facing a login error when I try to run Jenkins on Docker. How do I solve this?

You have to open the /var/log/jenkins/jenkins.log file to ...READ MORE

answered Jul 24, 2018 in Jenkins by Sophie may
• 10,620 points
3,590 views
0 votes
1 answer
0 votes
2 answers

How do I start jenkins on my Virtual Machine?

To start the Jenkins server please follow ...READ MORE

answered Dec 17, 2018 in Jenkins by Arohi
8,752 views
0 votes
1 answer

How do I install Jenkins on ubuntu?

Hey @Chandu, follow these steps to install ...READ MORE

answered Feb 26, 2019 in Jenkins by Kalgi
1,384 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,055 views
+2 votes
1 answer
0 votes
3 answers

How can I make Jenkins CI with Git trigger on pushes to master?

To automatically run build on code commit, follow ...READ MORE

answered Aug 7, 2019 in Jenkins by Sirajul
• 59,230 points
5,015 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP