Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JNLP Connections are deprecated in Jenkins what is the new recommended way connecting a windows slave to jenkins?

As the Title already states JNLP Connections are Deprecated Jenkins also gives a Message and a Hyperlink to

https://en.wikipedia.org/wiki/Java_Web_Start#Deprecation

So whats now the recommended way attaching a Windows Slave to Jenkins, there seems to be no real good guide on https://jenkins.io covering that topic.

like image 664
r4d1um Avatar asked Feb 24 '20 08:02

r4d1um


People also ask

Which is Jnlp connection to launch slave in Jenkins?

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.

Where is slave jar in Jenkins?

Go to “Build Executor Status” on the left sidebar and open jk_test. Click on “ slave. jar” and save it into the “jenkins” folder that we previously created on the slave machine.

Are JNLP connections deprecated in Jenkins?

JNLP Connections are deprecated in Jenkins what is the new recommended way connecting a windows slave to jenkins? - Stack Overflow JNLP Connections are deprecated in Jenkins what is the new recommended way connecting a windows slave to jenkins? Bookmark this question.

What is JNLP-slave in Jenkins?

That image name is deprecated, use jenkins/jnlp-slave. This is an image for Jenkins agent (FKA "slave") using JNLP to establish connection. This agent is powered by the Jenkins Remoting library, which version is being taken from the base Docker Agent image.

Why can’t I start/configure the Jenkins slave?

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. 12- You will see Agent is not able to reach the master Jenkins and the new jnlp jar can be downloaded from Jenkins

How to change JNLP launch agent in Jenkins?

Apply that change. Then goto Configure Jenkins -> Manage Nodes -> create new node or configure node Choose the setting "Launch agent by connecting it to the controller" under Launch Method. The phrasing has been improved significantly in the user interface by removing the references to "JNLP".


1 Answers

Open Source Alternative

There is an open source replacement called OpenWebStart which is based on IcedTeaWeb.

More information: Java Web Start is dead - long live OpenWebStart!

OpenWebStart is an open source implementation of the WebStart and JNLP standards (JSR-56).

[...]

In IcedTeaWeb we are currently working on mapping the JNLP spec and supporting its functions to the greatest extent possible. In addition to OpenWebStart, which uses IcedTeaWeb as its core, IcedTeaWeb is also used within AdoptOpenJDK to provide minimal WebStart in the Java 8 releases of AdoptOpenJDK. However, these are limited compared to OpenWebStart because they can only use the current JVM to run JNLP-based applications.

Get rid of Java Web Start using command-line installation of Jenkins service

When installing Jenkins service from the command-line using jenkins-slave.exe (aka winsw-*.exe), Java Web Start is no longer required. It seems that JNLP protocol is still used behind the scenes, so it may still have some deprecation issue in the future.

  • Official installation guide

Steps (assuming you have already set up the node in Jenkins master):

  1. Download latest service wrapper from http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/ (e. g. "winsw-2.2.0-net4.exe")
    Place it in the Custom WorkDir path and rename it to "jenkins-slave.exe"
  2. Download "agent.jar": http://YourJenkinsServer:8080/jnlpJars/agent.jar
    Place it in the Custom WorkDir path and rename it to "slave.jar"
  3. Create "jenkins-slave.xml" in the same directory:

    <service>
      <id>YourJenkinsSlaveServiceId</id>
      <name>Your Jenkins Slave Service Name</name>
      <description>This service runs an agent for Jenkins automation server.</description>
      <executable>C:\Program Files\Java\JRE8\bin\java.exe</executable>
      <arguments>-Xrs -jar "%BASE%\slave.jar" -jnlpUrl http://YourJenkinsServer:8080/computer/YourNodeName/slave-agent.jnlp -secret YourSecretStringConsistingOfHexadecimalCharacters -workDir=C:\YourNodeWorkDir</arguments>
      <logmode>rotate</logmode>
      <onfailure action="restart" />
      <download from="http://YourJenkinsServer:8080/jnlpJars/agent.jar" to="%BASE%\slave.jar"/>
     <extensions>
        <extension enabled="true" className="winsw.Plugins.RunawayProcessKiller.RunawayProcessKillerExtension" id="killOnStartup">
          <pidfile>%BASE%\jenkins_agent.pid</pidfile>
          <stopTimeout>5000</stopTimeout>
          <stopParentFirst>false</stopParentFirst>
        </extension>
      </extensions>
    </service>
    
  4. Adjust "jenkins-slave.xml" according to your environment. Make sure to adjust all strings I prefixed with "Your" and also the path to "java.exe". You'll find the secret string and correct jnlpUrl on the node configuration page of Jenkins master (e. g. http://YourJenkinsServer:8080/computer/YourNodeName/).
    Official documentation
  5. Create "jenkins-slave.exe.conf" file to prevent the executable from running on an earlier version of the .NET Framework.

    <configuration>
      <startup>
        <supportedRuntime version="v4.0"/>
      </startup>
    </configuration>
    
  6. Launch "cmd.exe" as administrator and navigate to directory of "jenkins-slave.exe".

  7. Install the service:
    jenkins-slave.exe install
  8. Launch the service:
    sc start YourJenkinsSlaveServiceId
like image 197
zett42 Avatar answered Sep 17 '22 17:09

zett42