Jenkins Windows Slave Configuration with Screenshots

Topic General, Tools

In our last articles, we have discussed how to Install and Configure Jenkins and how to Configure Jenkins Master-Slave setup on Linux machine

I have received few requests/suggestions through my last article  Jenkins Master-Slave setup on Linux machine to share the approach on Configuring Jenkins Slave on Windows Machine

So here I am with our new article on How to Configure a Jenkins Slave on Windows Machine and Install it as a windows Service

jenkins-windows

1- Login to Jenkins and Click on Manage Jenkins

jenkins-windows-slave-creation-1

2- To create a new Slave – Click on New Node

jenkins-windows-slave-creation-2

 

3- Name the node

jenkins-windows-slave-creation-3

 

4- Fill all the required details.

Please refer our master-slave configuration article to know all the details of parameters present in the node configuration page

 

jenkins-windows-slave-creation-4

5- Choose the appropriate Launch method

jenkins-windows-slave-creation-5

 

Below mentioned steps to configure and enable security are very important steps.

If you miss this you might not be able to start/configure the Jenkins slave because by default Jenkins disabled the TCP Port for JNLP agents and due to this Agent is not able to reach Master.

 

6 – Again click on Manage Jenkins

jenkins-windows-slave-creation-1

7- Then click on Configure Global Security

jenkins-windows-slave-creation-7

 

8- Find out the Enable Security option

jenkins-windows-slave-creation-8

9-  And then change the

jenkins-windows-slave-creation-9

10- Once the new node is created, it will be in Offline mode

jenkins-windows-slave-creation-10

11- Now click on the Slave agent

jenkins-windows-slave-creation-11

12- You will see Agent is not able to reach the master Jenkins and the new jnlp jar can be downloaded from Jenkins

 

jenkins-windows-slave-creations-12

13- Open the Jenkins URL from Agent Windows Machine and navigate to Slave Configuration page

Once done, just click on Launch Button – You will see a new popup which confirms the Jenkins Master-Slave Connection.

jenkins-windows-slave-creations-13

Lets now create and install this as a Windows service which will avoid the hassle to go to url and perform the same operation every time.

Once you create the service it will always be up & running and then you can manage it through Windows Services

14- Don’t close the pop-up, instead just click on File Menu – If its not visible just maximise the popup window

jenkins-windows-slave-creation-14

15- Now, just click on Install as a service option

jenkins-windows-slave-creation-15

 

16- It will prompt you for the confirmation

jenkins-windows-slave-creations-16

17- Just click on OK

jenkins-windows-slave-creation-17

18- Go to Windows Settings and then to check the Windows Services

jenkins-windows-slave-creation-18

19- You can see the Jenkins Windows Slave is successfully configure and running (If not then just Start the Service)

jenkins-windows-slave-creation-19

 

20- Go back to your Jenkins Slave Page and now you will see that Agent is Successfully Running and ready to build your project

jenkins-windows-slave-creation-20-done

Thats it. You have successfully configured the Jenkins Slave on Windows Machine and Installed it as a Windows Service.

12 comments… add one

  • Bhimsen

    Hi Ravi,
    Very informative documentation. Appreciate your efforts.
    Can you please help me in setting up Windows slave server using launch method “Launch slave agents via ssh” instead of Java Web start?

    • Hi Bhimsen,
      Thanks for your feedback and sorry for delay in reply.
      The easiest way to connect windows slave is with Java Web start, however there are cases where you need to use ssh for some reasons.
      Have you considered and tried with Cygwin for Windows ? “https://wiki.jenkins.io/display/JENKINS/SSH+slaves+and+Cygwin” or Freesshd “http://www.freesshd.com/?ctt=overview” for the same ?

  • Bryan Calvo

    Thanks.
    this guide worked 100% for me, thanks a lot

  • Ravi Kumar

    Hi Ravi,
    Thanks for your information.
    When we click on “Launch” button, an authentication pop-up is showed, we put our admin login, then we have a Jenkins window , and after some seconds, we have an error-popup Java.io.Exception failed to connect………
    Can you please help me on this:)
    Thanks in advance,
    RaviKumar

  • Ravi Kumar

    Hi Ravi,
    Thanks for your quick reply.
    The issue is not with the java version,as you mentioned in above screenshots i’m facing issue at step14 .
    After the jenkins slave pop-up i’m not finding the File Menu option to inastall as a service even maximized mode and after some time Error window pop-up appearing with the logs like..
    java.io.IOException:Failed to connect to URL:50000
    at org.jekinsci.remoting engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:242)…
    …..
    any suggessions!
    ThankYou

    • Did you try to check whether the port is accessible or not ?
      Have you made any changes to Iptables?
      By default, JNLP slave port configured as random – Have you tried with making fixed port or open Iptables over your firewall or configure port forwarding?
      If these also not working for you then, please share the network architecture of your master-slave connectivity and error logs.

    • Also, you can install the service with an alternative method described in my previous article
      http://scmquest.com/jenkins-file-menu-missing/

  • Rashmi

    Hi,

    When I clicked on Launch button from my agent, I see slave-agent jnlp file getting downloaded. I dont see any popup for making my agent as slave. What do I do now?

    Thanks,
    Rashmi

    • Hi Rashmi,
      Thanks for your query.
      Have you checked the browser settings (it should not block pop-ups), I would suggest to try on other browsers as well (IE, Firefox, Chrome, etc)
      However you can also make your agent as Jenkins slave through command line :

      Just run the below command with correct parameters as per your installation from your slave path:

      $ java -jar slave.jar -jnlpUrl http://yourserver:port/computer/slave-name/slave-agent.jnlp (You can refer the full command which should be displayed on your launch screen)

      Please make sure you are running this command from the location where the slave.jar was copied.

      If you see any error in download/ or fail to download – you can get the copy of your slave.jar from http://yourserver:port/jnlpJars/slave.jar

      Hope this helps and resolves your issue

  • Nan

    Ravi,

    Thanks a lot. It saved me hours of troubleshooting.

    Nan

Leave a Comment