diff --git a/bom/pom.xml b/bom/pom.xml index 2e88bea0f902..1f6c8cb3c555 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -261,31 +261,6 @@ THE SOFTWARE. instance-identity 2.2 - - org.jenkins-ci.modules - launchd-slave-installer - 1.2 - - - org.jenkins-ci.modules - slave-installer - 1.7 - - - org.jenkins-ci.modules - systemd-slave-installer - 1.1 - - - org.jenkins-ci.modules - upstart-slave-installer - 1.1 - - - org.jenkins-ci.modules - windows-slave-installer - 2.0 - org.jfree jfreechart diff --git a/core/src/main/java/hudson/slaves/JNLPLauncher.java b/core/src/main/java/hudson/slaves/JNLPLauncher.java index f549e6acb78d..1098769b8146 100644 --- a/core/src/main/java/hudson/slaves/JNLPLauncher.java +++ b/core/src/main/java/hudson/slaves/JNLPLauncher.java @@ -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; @@ -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(); @@ -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); } /** @@ -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 diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly b/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly index 6b33de6b8068..773a2ca0737b 100644 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly +++ b/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly @@ -35,8 +35,5 @@ THE SOFTWARE. - - - \ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs.html b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs.html deleted file mode 100644 index 2a398539e66e..000000000000 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs.html +++ /dev/null @@ -1,5 +0,0 @@ -
- If the agent JVM should be launched with additional VM arguments, such as "-Xmx256m", - specify those here. List of all the options are available - here. -
\ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_bg.html b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_bg.html deleted file mode 100644 index 551c5cbb746b..000000000000 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_bg.html +++ /dev/null @@ -1,6 +0,0 @@ -
- При необходимост тук попълнете допълнителните аргументи за стартирането на - виртуалната машина на Java на подчинените компютри като „-Xmx256m“. - Погледнете документацията за - пълния списък. -
diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_fr.html b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_fr.html deleted file mode 100644 index ef2647a6259d..000000000000 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_fr.html +++ /dev/null @@ -1,5 +0,0 @@ -
- Si la JVM agent doit être lancée avec des arguments supplémentaires, comme "-Xmx256m", - indiquez-les ici. La liste de toutes options disponibles est disponible - ici. -
\ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_it.html b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_it.html deleted file mode 100644 index 9dcbbe93bb20..000000000000 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_it.html +++ /dev/null @@ -1,6 +0,0 @@ -
- Se la JVM dell'agente deve essere avviata con argomenti VM aggiuntivi, - come "-Xmx256m", specificarli qui. Un elenco con tutte le opzioni è - disponibile - qui. -
diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_ja.html b/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_ja.html deleted file mode 100644 index 3356babf6f98..000000000000 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/help-vmargs_ja.html +++ /dev/null @@ -1,4 +0,0 @@ -
- エージェントのJVMに"-Xmx256m"のようなオプションをつけて起動する必要があるなら、ここで指定します。 - 利用可能なオプションの一覧を参照してください。 -
\ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/help.properties b/core/src/main/resources/hudson/slaves/JNLPLauncher/help.properties index d49d20b0ed01..493aa5437375 100644 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/help.properties +++ b/core/src/main/resources/hudson/slaves/JNLPLauncher/help.properties @@ -22,13 +22,9 @@ blurb=\ Allows an agent to be connected to the Jenkins controller whenever it is ready.
\ - In one mode, Java Web Start 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.)
\ + 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 Configure Global Security page, \ - you can customize the port on which the Jenkins controller will listen for incoming agent connections.
\ - 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). diff --git a/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly b/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly index 468192e4be7b..a31298a13ace 100644 --- a/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly +++ b/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly @@ -33,58 +33,30 @@ THE SOFTWARE. -

- ${%Connect agent to Jenkins one of these ways:} -

-
    - -
  • -

    - - ${%launch agent} - - ${%Launch agent from browser} -

    -
  • -
    + -
  • ${%Run from agent command line:}

    -
    javaws ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp
    -
  • -
  • -

    - ${%Or if the agent is headless:} -

    -
    java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar agent.jar -jnlpUrl ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp ${it.launcher.getWorkDirOptions(it)}
    -
  • +
    curl -sO ${jenkinsURL}jnlpJars/agent.jar
    +java -jar agent.jar -jnlpUrl ${jenkinsURL}${it.url}jenkins-agent.jnlp ${it.launcher.getWorkDirOptions(it)}
    -
  • ${%Run from agent command line:}

    -
    java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar agent.jar -jnlpUrl ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp -secret ${it.jnlpMac} ${it.launcher.getWorkDirOptions(it)}
    +
    curl -sO ${jenkinsURL}jnlpJars/agent.jar
    +java -jar agent.jar -jnlpUrl ${jenkinsURL}${it.url}jenkins-agent.jnlp -secret ${it.jnlpMac} ${it.launcher.getWorkDirOptions(it)}

    - ${%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:}

    echo ${it.jnlpMac} > secret-file
    -java${it.launcher.vmargs == null ? '' : ' ' + it.launcher.vmargs} -jar agent.jar -jnlpUrl ${h.inferHudsonURL(request)}${it.url}jenkins-agent.jnlp -secret @secret-file ${it.launcher.getWorkDirOptions(it)}
    -
  • +curl -sO ${jenkinsURL}jnlpJars/agent.jar +java -jar agent.jar -jnlpUrl ${jenkinsURL}${it.url}jenkins-agent.jnlp -secret @secret-file ${it.launcher.getWorkDirOptions(it)}
    -
-
diff --git a/core/src/main/resources/hudson/slaves/SlaveComputer/jenkins-agent.jnlp.jelly b/core/src/main/resources/hudson/slaves/SlaveComputer/jenkins-agent.jnlp.jelly index 22b7a562448e..e8053df3cedd 100644 --- a/core/src/main/resources/hudson/slaves/SlaveComputer/jenkins-agent.jnlp.jelly +++ b/core/src/main/resources/hudson/slaves/SlaveComputer/jenkins-agent.jnlp.jelly @@ -27,40 +27,11 @@ THE SOFTWARE. - - - - - - - Agent for ${it.displayName} - Jenkins project - - - - - - - + + - - - - - - - - - - - - - - + ${it.jnlpMac} ${it.node.nodeName} diff --git a/core/src/test/java/jenkins/RemotingJarSignatureTest.java b/core/src/test/java/jenkins/RemotingJarSignatureTest.java deleted file mode 100644 index a0d37e09a208..000000000000 --- a/core/src/test/java/jenkins/RemotingJarSignatureTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package jenkins; - -import static org.junit.Assert.assertNotNull; - -import hudson.remoting.Channel; -import hudson.remoting.Which; -import java.io.File; -import java.util.Enumeration; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import org.apache.commons.io.IOUtils; -import org.apache.commons.io.output.NullOutputStream; -import org.junit.Test; - -/** - * @author Kohsuke Kawaguchi - */ -public class RemotingJarSignatureTest { - /** - * Makes sure that the remoting jar is properly signed. - */ - @Test - public void testSignature() throws Exception { - File jar = Which.jarFile(Channel.class); - System.out.println("Verifying " + jar); - - JarFile myJar = new JarFile(jar, true); - - Enumeration entries = myJar.entries(); - while (entries.hasMoreElements()) { - JarEntry entry = entries.nextElement(); - if (entry.isDirectory()) continue; - - // unsigned files that are related to signatures - String name = entry.getName(); - if (name.equals("META-INF/MANIFEST.MF")) continue; - if (name.startsWith("META-INF/") && name.endsWith(".SF")) continue; - if (name.startsWith("META-INF/") && name.endsWith(".RSA")) continue; - if (name.startsWith("META-INF/") && name.endsWith(".DSA")) continue; - - // make sure bits are signed - IOUtils.copy(myJar.getInputStream(entry), NullOutputStream.NULL_OUTPUT_STREAM); - assertNotNull("No signature for " + name, entry.getCodeSigners()); - } - } -} diff --git a/pom.xml b/pom.xml index cea4dc7c95dd..78ed55665897 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ THE SOFTWARE. https://www.jenkins.io/changelog - 4.13 + 4.14 3.14 diff --git a/test/pom.xml b/test/pom.xml index e47c401ef355..d65a26019650 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -178,13 +178,6 @@ THE SOFTWARE. 318.va_f3ccb_729b_71 test
- - - org.jvnet.hudson - netx - 0.5-hudson-2 - test - org.mockito mockito-inline diff --git a/test/src/test/java/hudson/slaves/JNLPLauncherTest.java b/test/src/test/java/hudson/slaves/JNLPLauncherTest.java index f10e32060724..87378f6822ff 100644 --- a/test/src/test/java/hudson/slaves/JNLPLauncherTest.java +++ b/test/src/test/java/hudson/slaves/JNLPLauncherTest.java @@ -40,9 +40,9 @@ 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; @@ -50,8 +50,6 @@ 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; @@ -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; /** @@ -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)); } @@ -92,7 +87,6 @@ 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); @@ -100,39 +94,6 @@ public void testLaunchWithWorkDir() throws Exception { 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") @@ -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)); @@ -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)); @@ -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); @@ -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; @@ -288,14 +234,14 @@ public String call() { @Test public void testConfigRoundtrip() throws Exception { DumbSlave s = j.createSlave(); - JNLPLauncher original = new JNLPLauncher("a", "b"); + JNLPLauncher original = new JNLPLauncher("a"); s.setLauncher(original); j.assertEqualDataBoundBeans(((JNLPLauncher) s.getLauncher()).getWorkDirSettings(), RemotingWorkDirSettings.getEnabledDefaults()); RemotingWorkDirSettings custom = new RemotingWorkDirSettings(false, null, "custom", false); ((JNLPLauncher) s.getLauncher()).setWorkDirSettings(custom); HtmlPage p = j.createWebClient().getPage(s, "configure"); j.submit(p.getFormByName("config")); - j.assertEqualBeans(original, s.getLauncher(), "tunnel,vmargs"); + j.assertEqualBeans(original, s.getLauncher(), "tunnel"); j.assertEqualDataBoundBeans(((JNLPLauncher) s.getLauncher()).getWorkDirSettings(), custom); } diff --git a/test/src/test/java/jenkins/agents/WebSocketAgentsTest.java b/test/src/test/java/jenkins/agents/WebSocketAgentsTest.java index d26883f5a28a..7d786c8bebac 100644 --- a/test/src/test/java/jenkins/agents/WebSocketAgentsTest.java +++ b/test/src/test/java/jenkins/agents/WebSocketAgentsTest.java @@ -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") diff --git a/war/pom.xml b/war/pom.xml index bf000697debd..33247ac395ba 100644 --- a/war/pom.xml +++ b/war/pom.xml @@ -100,26 +100,6 @@ THE SOFTWARE. org.jenkins-ci.modules instance-identity - - org.jenkins-ci.modules - launchd-slave-installer - - - org.jenkins-ci.modules - slave-installer - - - org.jenkins-ci.modules - systemd-slave-installer - - - org.jenkins-ci.modules - upstart-slave-installer - - - org.jenkins-ci.modules - windows-slave-installer -