Skip to content

Commit

Permalink
[JENKINS-51820] Removing Java Web Start support (#6543)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
jglick and timja authored May 13, 2022
1 parent d01a107 commit 5f91002
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 286 deletions.
25 changes: 0 additions & 25 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,31 +261,6 @@ THE SOFTWARE.
<artifactId>instance-identity</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>launchd-slave-installer</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>slave-installer</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>systemd-slave-installer</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>upstart-slave-installer</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>windows-slave-installer</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
Expand Down
36 changes: 14 additions & 22 deletions core/src/main/java/hudson/slaves/JNLPLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import jenkins.model.Jenkins;
import jenkins.slaves.RemotingWorkDirSettings;
import jenkins.util.SystemProperties;
import jenkins.util.java.JavaUtils;
import jenkins.websocket.WebSockets;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -67,11 +66,10 @@ public class JNLPLauncher extends ComputerLauncher {
public final String tunnel;

/**
* Additional JVM arguments. Can be null.
* @since 1.297
* @deprecated No longer used.
*/
@CheckForNull
public final String vmargs;
@Deprecated
public final transient String vmargs = null;

@NonNull
private RemotingWorkDirSettings workDirSettings = RemotingWorkDirSettings.getEnabledDefaults();
Expand Down Expand Up @@ -103,10 +101,20 @@ public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs, @C
}
}

// TODO cannot easily make tunnel into a @DataBoundSetter because then the @DataBoundConstructor would be on a no-arg constructor
// which is already defined and deprecated. Could retroactively let no-arg constructor use default for workDirSettings,
// which would be a behavioral change only for callers of the Java constructor (unlikely).
@DataBoundConstructor
public JNLPLauncher(@CheckForNull String tunnel) {
this.tunnel = Util.fixEmptyAndTrim(tunnel);
}

/**
* @deprecated use {@link JNLPLauncher#JNLPLauncher(String)}
*/
@Deprecated
public JNLPLauncher(@CheckForNull String tunnel, @CheckForNull String vmargs) {
this.tunnel = Util.fixEmptyAndTrim(tunnel);
this.vmargs = Util.fixEmptyAndTrim(vmargs);
}

/**
Expand Down Expand Up @@ -249,22 +257,6 @@ public FormValidation doCheckWebSocket(@QueryParameter boolean webSocket, @Query

}

/**
* Returns true if Java Web Start button should be displayed.
* Java Web Start is only supported when the Jenkins server is
* running with Java 8. Earlier Java versions are not supported by Jenkins.
* Later Java versions do not support Java Web Start.
*
* This flag is checked in {@code config.jelly} before displaying the
* Java Web Start button.
* @return {@code true} if Java Web Start button should be displayed.
* @since 2.153
*/
@Restricted(NoExternalUse.class) // Jelly use
public boolean isJavaWebStartSupported() {
return JavaUtils.isRunningWithJava8OrBelow();
}

/**
* Overrides the url that inbound TCP agents should connect to
* as advertised in the agent.jnlp file. If not set, the default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,5 @@ THE SOFTWARE.
<f:entry title="${%Tunnel connection through}" help="/help/system-config/master-slave/jnlp-tunnel.html">
<f:textbox field="tunnel"/>
</f:entry>
<f:entry title="${%JVM options}" field="vmargs">
<f:textbox />
</f:entry>
</f:advanced>
</j:jelly>

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@

blurb=\
Allows an agent to be connected to the Jenkins controller whenever it is ready.<br>\
In one mode, <a href="https://en.wikipedia.org/wiki/Java_Web_Start" rel="noopener noreferrer" target="_blank">Java Web Start</a> is used. \
In this case, a JNLP file must be opened on the agent machine, \
which will establish a TCP connection to the Jenkins controller. \
(Other launch methods use a JNLP file but not Java Web Start, or do not use a JNLP file at all.)<br>\
The agent machine will establish a TCP connection to the Jenkins controller. \
This means that the agent need not be reachable from the controller; \
the agent just needs to be able to reach the controller. \
If you have enabled security via the <i>Configure Global Security</i> page, \
you can customize the port on which the Jenkins controller will listen for incoming agent connections.<br>\
By default, the agent will launch a GUI, but it is also possible to run \
an agent without a GUI, for example as a Windows service.
you can customize the port on which the Jenkins controller will listen for incoming agent connections \
(unnecessary when using WebSocket mode).
44 changes: 8 additions & 36 deletions core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -33,58 +33,30 @@ THE SOFTWARE.
</j:when>
<j:when test="${it.offline and !it.temporarilyOffline}">
<j:if test="${h.hasPermission(it, it.CONNECT)}">
<p>
${%Connect agent to Jenkins one of these ways:}
</p>
<ul>
<j:if test="${it.launcher.javaWebStartSupported}">
<li>
<p>
<a href="jenkins-agent.jnlp" id="jnlp-link">
<img src="${imagesURL}/webstart.gif" alt="${%launch agent}" />
</a>
${%Launch agent from browser}
</p>
</li>
</j:if>
<j:set var="jenkinsURL" value="${h.inferHudsonURL(request)}"/>
<j:choose>
<j:when test="${it.ACL.hasPermission(app.ANONYMOUS, it.CONNECT)}">
<li>
<p>
${%Run from agent command line:}
</p>
<pre>javaws ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp</pre>
</li>
<li>
<p>
${%Or if the agent is headless:}
</p>
<pre>java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/agent.jar">agent.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp ${it.launcher.getWorkDirOptions(it)}</pre>
</li>
<pre>curl -sO ${jenkinsURL}jnlpJars/agent.jar
java -jar <a href="${rootURL}/jnlpJars/agent.jar">agent.jar</a> -jnlpUrl ${jenkinsURL}${it.url}jenkins-agent.jnlp ${it.launcher.getWorkDirOptions(it)}</pre>
</j:when>
<j:otherwise>
<li>
<p>
${%Run from agent command line:}
</p>
<!-- TODO conceal secret w/ JS if possible -->
<pre>java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/agent.jar">agent.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp -secret ${it.jnlpMac} ${it.launcher.getWorkDirOptions(it)}</pre>
<pre>curl -sO ${jenkinsURL}jnlpJars/agent.jar
java -jar <a href="${rootURL}/jnlpJars/agent.jar">agent.jar</a> -jnlpUrl ${jenkinsURL}${it.url}jenkins-agent.jnlp -secret ${it.jnlpMac} ${it.launcher.getWorkDirOptions(it)}</pre>
<p>
${%Run from agent command line, with the secret stored in a file:}
${%Or run from agent command line, with the secret stored in a file:}
</p>
<pre>echo ${it.jnlpMac} > secret-file
java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar <a href="${rootURL}/jnlpJars/agent.jar">agent.jar</a> -jnlpUrl ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp -secret @secret-file ${it.launcher.getWorkDirOptions(it)}</pre>
</li>
curl -sO ${jenkinsURL}jnlpJars/agent.jar
java -jar <a href="${rootURL}/jnlpJars/agent.jar">agent.jar</a> -jnlpUrl ${jenkinsURL}${it.url}jenkins-agent.jnlp -secret @secret-file ${it.launcher.getWorkDirOptions(it)}</pre>
</j:otherwise>
</j:choose>
</ul>
<!--
<p>
<a href="custom-jnlp" style="margin-left:3em">
(tweak launch parameters)
</a>
</p>
-->
</j:if>
</j:when>
<j:otherwise>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,11 @@ THE SOFTWARE.
<l:view contentType="application/x-java-jnlp-file">
<j:invokeStatic var="rootURL" className="hudson.slaves.JNLPLauncher" method="getInboundAgentUrl" />

<!--
See https://www.dallaway.com/acad/webstart/ for obtaining the certificate.
-->

<!-- See https://docs.oracle.com/javase/8/docs/technotes/guides/javaws/developersguide/syntax.html for the syntax -->
<jnlp spec="1.0+"
codebase="${rootURL}computer/${h.encode(it.node.nodeName)}/">

<information>
<title>Agent for ${it.displayName}</title>
<vendor>Jenkins project</vendor>
<homepage href="https://jenkins-ci.org/"/>
</information>

<security>
<all-permissions/>
</security>

<!-- JavaWebStart is no longer supported, but a subset of the syntax is retained for compatibility reasons: hudson.remoting.Launcher.parseJnlpArguments -->
<jnlp>
<j:set var="launcher" value="${it.delegatedLauncher}"/>

<resources>
<j:set var="port" value="${request.getParameter('debugPort')}"/>
<j:choose>
<j:when test="${port!=null}">
<j2se version="1.8+" java-vm-args="${launcher.vmargs} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=${port}" />
</j:when>
<j:otherwise>
<j2se version="1.8+" java-vm-args="${launcher.vmargs}"/>
</j:otherwise>
</j:choose>
<jar href="${rootURL}jnlpJars/remoting.jar"/>
</resources>

<application-desc main-class="hudson.remoting.jnlp.Main">
<application-desc>
<argument>${it.jnlpMac}</argument>
<argument>${it.node.nodeName}</argument>
<j:if test="${launcher.webSocket}">
Expand Down
46 changes: 0 additions & 46 deletions core/src/test/java/jenkins/RemotingJarSignatureTest.java

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ THE SOFTWARE.
<changelog.url>https://www.jenkins.io/changelog</changelog.url>

<!-- Bundled Remoting version -->
<remoting.version>4.13</remoting.version>
<remoting.version>4.14</remoting.version>
<!-- Minimum Remoting version, which is tested for API compatibility -->
<remoting.minimum.supported.version>3.14</remoting.minimum.supported.version>

Expand Down
7 changes: 0 additions & 7 deletions test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,6 @@ THE SOFTWARE.
<version>318.va_f3ccb_729b_71</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- for testing JNLP launch. -->
<groupId>org.jvnet.hudson</groupId>
<artifactId>netx</artifactId>
<version>0.5-hudson-2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
Expand Down
Loading

0 comments on commit 5f91002

Please sign in to comment.