Child pages
  • Launch Java Web Start slave agent via Windows Scheduler

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Configure your node to use the "Launch slave agents via Java Web Start" launch method
    • Click Save
  2. Note the command required to launch the slave
    • On the new slave node's Jenkins page, note the slave command line shown. 
      • It will be like: java -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>
  3. Obtain the slave.jar file and copy it to your new Windows slave node
    • In the command line noted in the last step, the "slave.jar" is a hyperlink. Click it to download the slave.jar file.
    • Copy the slave.jar file to a permanent location on your slave machine
  4. Ensure that you have a java version available on your slave machine
    • If not, obtain and install a copy of Java
  5. Run the command manually from a CMD window on your slave to confirm that it works
    • Open the CMD window
    • Run the command (the one like java -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>)
    • Go back to the node's web page in Jenkins.  If everything works then page should say "Connected via JNLP agent"
    • Stop the command (control-c)
  6. Register a new scheduled job to run the same command
    • Open "Task Scheduler" on your windows machine
      • Start -> Run: task Scheduler
    • Create a basic task (Menu: Action -> Create Basic Task)
      • First page of the wizard:
        • Name: Jenkins Slave
        • Description (optional)
        • Click Next
      • Next page of the wizard
        • When do you want the task to start: select "When the computer starts"
        • Click Next
      • Next page of the wizard
        • What action do you want the task to perform: select "Start a program"
        • Click Next
      • Next page of the wizard
        • Program/Script: enter "java.exe" (or the full path to your java.exe)
        • Add arguments: enter the rest of the command, like " -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>"
        • eg: -jar D:\Scripts\jenkins\slave.jar -jnlpUrl http://jenkinshost.example.com:8080/computer/buildNode1/slave-agent.jnlp -secret d6a84df1fc4f45ddc9c6ab34b08f13391983ffffffffffb3488b7d5ac77fbc7
        • Click Next
      • Next page of the wizard
        • Click the check box "Open the Properties dialog for this task when I click Finish
        • Click Finish
    • Update the task's properties
      • On the General tab
        • Select the user to run the task as
        • Select "Run whether use is logged on or not"
      • On the settings tab
        • Uncheck "Stop the task if it runs longer than"
        • Check "Run the task as soon as possible after a scheduled start is missed"
        • Check "If the task failed, restart every: 10 minutes", and "Attempt to restart up to: 3 times"
      • Click OK
  7. Start the scheduled task and again check that Jenkins can connect
    • Go back to the node's web page in Jenkins.  If everything works then page should say "Connected via JNLP agent"