Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-51820] Removing Java Web Start support #6543

Merged
merged 13 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
17 changes: 0 additions & 17 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 @@ -249,22 +248,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
27 changes: 1 addition & 26 deletions core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -33,51 +33,26 @@ 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: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>
</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>
<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>
</j:otherwise>
</j:choose>
</ul>
<!--
<p>
<a href="custom-jnlp" style="margin-left:3em">
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.

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

<!-- Bundled Remoting version -->
<remoting.version>4.13</remoting.version>
<!-- TODO https://github.com/jenkinsci/remoting/pull/532 -->
<remoting.version>4.14-rc3008.3660a_f2a_4925</remoting.version>
timja marked this conversation as resolved.
Show resolved Hide resolved
<!-- 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
60 changes: 3 additions & 57 deletions test/src/test/java/hudson/slaves/JNLPLauncherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,16 @@
import hudson.model.Node;
import hudson.model.Node.Mode;
import hudson.model.Slave;
import hudson.remoting.Launcher;
import hudson.remoting.Which;
import hudson.util.ArgumentListBuilder;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import jenkins.security.SlaveToMasterCallable;
import jenkins.slaves.RemotingWorkDirSettings;
import netx.jnlp.runtime.JNLPRuntime;
import org.junit.Assume;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
Expand All @@ -60,7 +58,6 @@
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.LoggerRule;
import org.jvnet.hudson.test.SmokeTest;
import org.jvnet.hudson.test.TestExtension;
import org.jvnet.hudson.test.recipes.LocalData;

/**
Expand All @@ -80,8 +77,6 @@ public class JNLPLauncherTest {
*/
@Test
public void testLaunch() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testLaunch because we are running headless", GraphicsEnvironment.isHeadless());

Computer c = addTestAgent(false);
launchJnlpAndVerify(c, buildJnlpArgs(c));
}
Expand All @@ -92,47 +87,13 @@ public void testLaunch() throws Exception {
@Test
@Issue("JENKINS-39370")
public void testLaunchWithWorkDir() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testLaunch because we are running headless", GraphicsEnvironment.isHeadless());
File workDir = tmpDir.newFolder("workDir");

Computer c = addTestAgent(false);
launchJnlpAndVerify(c, buildJnlpArgs(c).add("-workDir", workDir.getAbsolutePath()));
assertTrue("Remoting work dir should have been created", new File(workDir, "remoting").exists());
}

/**
* Tests the '-headless' option.
* (Although this test doesn't really assert that the agent really is running in a headless mode.)
*/
@Test
public void testHeadlessLaunch() throws Exception {
Computer c = addTestAgent(false);
launchJnlpAndVerify(c, buildJnlpArgs(c).add("-arg", "-headless"));
// make sure that onOffline gets called just the right number of times
assertEquals(1, ComputerListener.all().get(ListenerImpl.class).offlined);
}

@Test
@Issue("JENKINS-44112")
public void testHeadlessLaunchWithWorkDir() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testLaunch because we are running headless", GraphicsEnvironment.isHeadless());

Computer c = addTestAgent(true);
launchJnlpAndVerify(c, buildJnlpArgs(c).add("-arg", "-headless"));
assertEquals(1, ComputerListener.all().get(ListenerImpl.class).offlined);
}

@Test
@Issue("JENKINS-39370")
public void testHeadlessLaunchWithCustomWorkDir() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testLaunch because we are running headless", GraphicsEnvironment.isHeadless());
File workDir = tmpDir.newFolder("workDir");

Computer c = addTestAgent(false);
launchJnlpAndVerify(c, buildJnlpArgs(c).add("-arg", "-headless", "-workDir", workDir.getAbsolutePath()));
assertEquals(1, ComputerListener.all().get(ListenerImpl.class).offlined);
}

@Test
@LocalData
@Issue("JENKINS-44112")
Expand Down Expand Up @@ -160,7 +121,6 @@ public void testDefaults() {
@Test
@Issue("JENKINS-47056")
public void testDelegatingComputerLauncher() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testDelegatingComputerLauncher because we are running headless", GraphicsEnvironment.isHeadless());
File workDir = tmpDir.newFolder("workDir");

ComputerLauncher launcher = new JNLPLauncher("", "", new RemotingWorkDirSettings(false, workDir.getAbsolutePath(), "internalDir", false));
Expand All @@ -173,7 +133,6 @@ public void testDelegatingComputerLauncher() throws Exception {
@Test
@Issue("JENKINS-47056")
public void testComputerLauncherFilter() throws Exception {
Assume.assumeFalse("Skipping JNLPLauncherTest.testComputerLauncherFilter because we are running headless", GraphicsEnvironment.isHeadless());
File workDir = tmpDir.newFolder("workDir");

ComputerLauncher launcher = new JNLPLauncher("", "", new RemotingWorkDirSettings(false, workDir.getAbsolutePath(), "internalDir", false));
Expand All @@ -183,17 +142,6 @@ public void testComputerLauncherFilter() throws Exception {
assertTrue("Remoting work dir should have been created", new File(workDir, "internalDir").exists());
}

@TestExtension("testHeadlessLaunch")
public static class ListenerImpl extends ComputerListener {
int offlined = 0;

@Override
public void onOffline(Computer c) {
offlined++;
assertTrue(c.isOffline());
}
}

private static class DelegatingComputerLauncherImpl extends DelegatingComputerLauncher {
DelegatingComputerLauncherImpl(ComputerLauncher launcher) {
super(launcher);
Expand All @@ -209,10 +157,8 @@ private static class ComputerLauncherFilterImpl extends ComputerLauncherFilter {
private ArgumentListBuilder buildJnlpArgs(Computer c) throws Exception {
ArgumentListBuilder args = new ArgumentListBuilder();
args.add(new File(new File(System.getProperty("java.home")), "bin/java").getPath(), "-jar");
args.add(Which.jarFile(JNLPRuntime.class).getAbsolutePath());
args.add("-headless", "-basedir");
args.add(j.createTmpDir());
args.add("-nosecurity", "-jnlp", j.getURL() + "computer/" + c.getName() + "/jenkins-agent.jnlp");
args.add(Which.jarFile(Launcher.class).getAbsolutePath());
args.add("-jnlpUrl", j.getURL() + "computer/" + c.getName() + "/jenkins-agent.jnlp");

if (c instanceof SlaveComputer) {
SlaveComputer sc = (SlaveComputer) c;
Expand Down
3 changes: 1 addition & 2 deletions test/src/test/java/jenkins/agents/WebSocketAgentsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ public class WebSocketAgentsTest {
* Verify basic functionality of an agent in {@code -webSocket} mode.
* Requires {@code remoting} to have been {@code mvn install}ed.
* Does not show {@code FINE} or lower agent logs ({@link JenkinsRule#showAgentLogs(Slave, LoggerRule)} cannot be used here).
* Unlike {@link hudson.slaves.JNLPLauncherTest} this does not use {@code javaws};
* closer to {@link hudson.bugs.JnlpAccessWithSecuredHudsonTest}.
* Related to {@link hudson.slaves.JNLPLauncherTest} (also see closer to {@link hudson.bugs.JnlpAccessWithSecuredHudsonTest}).
* @see hudson.remoting.Launcher
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
Expand Down
20 changes: 0 additions & 20 deletions war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,6 @@ THE SOFTWARE.
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>instance-identity</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>launchd-slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>systemd-slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>upstart-slave-installer</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>windows-slave-installer</artifactId>
</dependency>
<dependency>
<!--
We bundle slf4j binding since we got some components (sshd for example)
Expand Down
Binary file removed war/src/main/webapp/images/webstart.gif
Binary file not shown.