Skip to content

Commit

Permalink
Merge pull request #3076 from jglick/CommandLauncher-JENKINS-47393
Browse files Browse the repository at this point in the history
[JENKINS-47393] Split CommandLauncher to a plugin
  • Loading branch information
jglick committed Oct 17, 2017
2 parents 8ac33fd + 417afd6 commit d292929
Show file tree
Hide file tree
Showing 58 changed files with 24 additions and 1,420 deletions.
5 changes: 4 additions & 1 deletion core/src/main/java/hudson/ClassicPluginStrategy.java
Expand Up @@ -425,7 +425,8 @@ public VersionNumber getRequiredVersion() {
new DetachedPlugin("antisamy-markup-formatter", "1.553.*", "1.0"),
new DetachedPlugin("matrix-project", "1.561.*", "1.0"),
new DetachedPlugin("junit", "1.577.*", "1.0"),
new DetachedPlugin("bouncycastle-api", "2.16.*", "2.16.0")
new DetachedPlugin("bouncycastle-api", "2.16.*", "2.16.0"),
new DetachedPlugin("command-launcher", "2.86.*", "1.0")

This comment has been minimized.

Copy link
@ndeloof

ndeloof Oct 27, 2017

Contributor

this introduced a blocker issue for users upgrading Jenkins to latest with docker-slaves plugin installed. I'm not sure how jenkins is supposed to handle this, I would expect it automatically add this command-launcher plugin as docker-slaves plugin is loaded, but without plugins bundled into the WAR anymore, does this mechanism still work ?

This comment has been minimized.

Copy link
@daniel-beck

daniel-beck Oct 28, 2017

Member

Detached plugins are still bundled, see d292929#diff-82c9d27714c878724d651c3c4a016ddbR407

Please file a proper bug with steps to reproduce instead of commenting on a commit.

));

/** Implicit dependencies that are known to be unnecessary and which must be cut out to prevent a dependency cycle among bundled plugins. */
Expand All @@ -434,6 +435,8 @@ public VersionNumber getRequiredVersion() {
"script-security/windows-slaves",
"script-security/antisamy-markup-formatter",
"script-security/matrix-project",
"script-security/bouncycastle-api",
"script-security/command-launcher",
"credentials/matrix-auth",
"credentials/windows-slaves"
));
Expand Down
17 changes: 10 additions & 7 deletions core/src/main/java/hudson/model/Slave.java
Expand Up @@ -26,6 +26,7 @@

import com.google.common.collect.ImmutableSet;
import hudson.DescriptorExtensionList;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Launcher.RemoteLauncher;
Expand All @@ -34,7 +35,6 @@
import hudson.remoting.Callable;
import hudson.remoting.Channel;
import hudson.remoting.Which;
import hudson.slaves.CommandLauncher;
import hudson.slaves.ComputerLauncher;
import hudson.slaves.DumbSlave;
import hudson.slaves.JNLPLauncher;
Expand Down Expand Up @@ -225,6 +225,15 @@ public void setUserId(String userId){
}

public ComputerLauncher getLauncher() {
if (launcher == null && !StringUtils.isEmpty(agentCommand)) {
try {
launcher = (ComputerLauncher) Jenkins.getInstance().getPluginManager().uberClassLoader.loadClass("hudson.slaves.CommandLauncher").getConstructor(String.class, EnvVars.class).newInstance(agentCommand, null);
agentCommand = null;
save();
} catch (Exception x) {
LOGGER.log(Level.WARNING, "could not update historical agentCommand setting to CommandLauncher", x);
}
}
// Default launcher does not use Work Directory
return launcher == null ? new JNLPLauncher(false) : launcher;
}
Expand Down Expand Up @@ -502,12 +511,6 @@ public int hashCode() {
* Invoked by XStream when this object is read into memory.
*/
protected Object readResolve() {
// convert the old format to the new one
if (launcher == null) {
launcher = (agentCommand == null || agentCommand.trim().length() == 0)
? new JNLPLauncher(false)
: new CommandLauncher(agentCommand);
}
if(nodeProperties==null)
nodeProperties = new DescribableList<NodeProperty<?>,NodePropertyDescriptor>(Jenkins.getInstance().getNodesObject());
return this;
Expand Down
81 changes: 0 additions & 81 deletions core/src/main/java/hudson/slaves/CommandConnector.java

This file was deleted.

212 changes: 0 additions & 212 deletions core/src/main/java/hudson/slaves/CommandLauncher.java

This file was deleted.

2 changes: 0 additions & 2 deletions core/src/main/resources/hudson/model/Messages.properties
Expand Up @@ -239,14 +239,12 @@ Run.Summary.Unknown=?

Slave.InvalidConfig.Executors=Invalid agent configuration for {0}. Invalid # of executors.
Slave.InvalidConfig.NoName=Invalid agent configuration. Name is empty
Slave.Launching={0} Launching agent
Slave.Network.Mounted.File.System.Warning=Are you sure you want to use network mounted file system for FS root? Note that this directory does not need to be visible to the master.
Slave.Remote.Director.Mandatory=Remote directory is mandatory
Slave.Terminated={0} agent was terminated
Slave.Remote.Relative.Path.Warning=Are you sure you want to use a relative path for the FS root? Note that relative \
paths require that you can assure that the selected launcher provides a consistent current working directory. Using \
an absolute path is highly recommended.
Slave.UnableToLaunch=Unable to launch the agent for {0}{1}
Slave.UnixSlave=This is a Unix agent
Slave.WindowsSlave=This is a Windows agent

Expand Down
6 changes: 0 additions & 6 deletions core/src/main/resources/hudson/model/Messages_bg.properties
Expand Up @@ -626,9 +626,6 @@ Computer.BadChannel=\
Computer.DisconnectPermission.Description=\
\u0422\u043e\u0432\u0430 \u043f\u0440\u0430\u0432\u043e \u0434\u0430\u0432\u0430 \u0432\u044a\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442 \u0434\u0430 \u043f\u0440\u0435\u043a\u044a\u0441\u0432\u0430\u0442\u0435 \u0432\u0440\u044a\u0437\u043a\u0430\u0442\u0430 \u043a\u044a\u043c \u0430\u0433\u0435\u043d\u0442\u0438 \u0438\u043b\u0438 \u0434\u0430 \u0433\u0438\
\u043e\u0431\u044f\u0432\u044f\u0432\u0430\u0442\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438\u0437\u0432\u044a\u043d \u043b\u0438\u043d\u0438\u044f.
# Unable to launch the agent for {0}{1}
Slave.UnableToLaunch=\
\u0410\u0433\u0435\u043d\u0442\u044a\u0442 \u0437\u0430 {0}{1} \u043d\u0435 \u043c\u043e\u0436\u0435 \u0434\u0430 \u0441\u0435 \u0441\u0442\u0430\u0440\u0442\u0438\u0440\u0430
# This permission allows users to run jobs as them on agents.
Computer.BuildPermission.Description=\
\u0422\u043e\u0432\u0430 \u043f\u0440\u0430\u0432\u043e \u0434\u0430\u0432\u0430 \u0432\u044a\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442 \u043d\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0438\u0442\u0435 \u0434\u0430 \u0438\u0437\u043f\u044a\u043b\u043d\u044f\u0432\u0430\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 \u0430\u0433\u0435\u043d\u0442\u0438\u0442\u0435\
Expand Down Expand Up @@ -691,9 +688,6 @@ Computer.DeletePermission.Description=\
# Agent
Computer.Permissions.Title=\
\u0410\u0433\u0435\u043d\u0442
# {0} Launching agent
Slave.Launching=\
TODO
# This is a Unix agent
Slave.UnixSlave=\
\u0422\u043e\u0432\u0430 \u0435 \u0430\u0433\u0435\u043d\u0442 \u0437\u0430 Unix
Expand Down

0 comments on commit d292929

Please sign in to comment.