5

Built a new Windows Server 2016 to act as a target for jenkins orchestrated builds. We are not supposed to use oracle java anymore, so I got coretta openJDK. OpenJDK does not support javaws any more. The executable does not ship with it. I have seen some scripted workarounds, but they do not work and are poorly written to boot.

What are we supposed to use to launch slave agents on Windows machines?

cknowlto
  • 51
  • 1
  • 2

3 Answers3

1

There are several ways to implement this but since this is a windows server you can follow steps on https://github.com/kohsuke/winsw/blob/master/doc/installation.md#winsw-installation-guide to install jenkins slave as service without javaws.

Mike
  • 512
  • 3
  • 16
  • That does not do what I asked. That will run the jenkins app as a service. I do not need that. I need the slave agent to be launched on windows. Unfortunately, running the slave jar file directly, only launches a "wget" to download the jnlp which is never going to run. – cknowlto May 22 '19 at 17:55
  • if you follow the documentation (Especially Installation step details) then it will help you to configure the windows agent as jenkins slave service. So, that service will connect to jenkins and it doesn't require the javaaws instead it uses java.exe. If I will get some time today then I will create a video of it but no promise until then you can read the steps and try to implement it. – Mike May 23 '19 at 18:10
1

I believe @Mike was referring to: Install Slave as a Windows service (cmd version), which does not need JNLP/javaws.

OR, under Jenkins 2 (we are using 2.121.1 plus WMI Windows Agents (aka windows-slaves:1.4), there is now an option to "Let Jenkins control this Windows slave as a Windows service", essentially in the same fashion as a Linux node.

Jenkins Node launch config

You must have an Admin account (and password). We had to follow the guidance to edit registry when "Windows agents fail to start via DCOM" (Guidance is for Server 2012) to remotely manage the service. So far, seems to be working OK, YMMV. So far, seems to be working OK, no "subtle probelms"; YMMV.

For entries:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID{72C24DD5-D70A-438B-8A42-98424B88AFB8}
  • HKEY_CLASSES_ROOT\CLSID{76A64158-CB41-11D1-8B02-00600806D9B6}

(There are several matches for the keys; just change the two locations indicated)

  1. Launch 'regedit' (as Administrator)
  2. Find (Ctrl+F) the following registry key: "{72C24DD5-D70A-438B-8A42-98424B88AFB8}" in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\
  3. Right click and select 'Permissions'
  4. Change owner to administrators group (Advanced...).
  5. Change permissions for administrators group. Grant Full Control.
  6. Change owner back to TrustedInstaller (user is "NT Service\TrustedInstaller" on local machine)
  7. Repeat the steps 1-6 for HKEY_CLASSES_ROOT\CLSID{76A64158-CB41-11D1-8B02-00600806D9B6}
  8. Restart Remote Registry Service (Administrative Tools / Services)
Ian W
  • 4,559
  • 2
  • 18
  • 37
0

For me the easiest and best working solution to launch Windows Jenkins Agents without JNLP was to run in the command prompt java -jar agent.jar ... command. The command parameters should be grabbed from the url of the agent:

http://your_jenkins_url/computer/your_agent_name_or_ip/

I downloaded the agent.jar on my PC, moved it to a desired directory, launched the Command Prompt from the dir where the agent.jar was moved and executed the proposed command with the appropriate parameters.

In my case:

java -jar agent.jar -jnlpUrl http://your_jenkins_url/computer/your_agent_name_or_ip/slave-agent.jnlp -secret 76986574e97c2b635c7076740dc93326eaaf5a3ad30573144915489a1ccfee44 -workDir "D:\jenkins"

This was one of the proposed approaches in the docs here - https://www.jenkins.io/doc/administration/requirements/upgrade-java-guidelines/

Java Web Start Java Web Start has been removed in Java 11. When a Jenkins controller is running on Java 11, the Java Web Start button will no longer appear in the Web UI. Agents for a Java 11 Jenkins server can’t be launched from a *.jnlp file downloaded to a web browser.

There are no plans to replace this functionality. Connect agents to Jenkins on Java 11 with plugins like SSH Build Agents Plugin, with operating system command line calls to java -jar agent.jar, or by using containers.

plamenti
  • 109
  • 1
  • 4
  • But that does not help with the installation of that process into a windows service. Sure you can use "other methods" to turn that execution line into a windows service but honestly Jenkins should have a method to do and manage this on their own instead of us all having to do this manually. Jenkins should create a powershell script for windows that takes in the working directory with the agent.jar file within it as well the url and secret and manage the service installation (and uninstallation) – Eric Weintraub Mar 10 '23 at 14:27