Package hudson.plugins.swarm
Class PluginImpl
java.lang.Object
hudson.Plugin
hudson.plugins.swarm.PluginImpl
Exposes an entry point to add a new Swarm agent.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.Plugin
Plugin.DummyImpl -
Field Summary
Fields inherited from class hudson.Plugin
SKIP_PERMISSION_CHECK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddoAddSlaveLabels(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String name, String labels) Add labels to an agent.voiddoCheckSlaveExists(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String name) Check if an agent exists (both is in the list of Nodes and has an associated Computer object).
The effect is toServletResponse.setContentType(java.lang.String)("text/plain; charset=UTF-8")into the responserspand either write"ok"if it does, or report the error in plain text pergetNodeByName(java.lang.String, org.kohsuke.stapler.StaplerResponse2)andHttpServletResponse.setStatus(int)(HttpServletResponse.SC_NOT_FOUND).
Rationale: In practice, agents may get lost on the Jenkins controller server side due to networking issues or Jenkins controller JVM or hardware/OS lags.voiddoCreateSlave(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String name, String description, int executors, String remoteFsRoot, String labels, Node.Mode mode, String hash, boolean deleteExistingClients, boolean keepDisconnectedClients) Add a new Swarm agent.voiddoGetSlaveLabels(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String name) Get the list of labels for an agent.voiddoRemoveSlaveLabels(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String name, String labels) Remove labels from an agent.Methods inherited from class hudson.Plugin
configure, configure, configure, doDynamic, doDynamic, getConfigXml, getTarget, getWrapper, load, postInitialize, save, setServletContext, start, stop
-
Constructor Details
-
PluginImpl
public PluginImpl()
-
-
Method Details
-
doGetSlaveLabels
public void doGetSlaveLabels(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String name) throws IOException Get the list of labels for an agent.- Throws:
IOException
-
doCheckSlaveExists
public void doCheckSlaveExists(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String name) throws IOException Check if an agent exists (both is in the list of Nodes and has an associated Computer object).
The effect is toServletResponse.setContentType(java.lang.String)("text/plain; charset=UTF-8")into the responserspand either write"ok"if it does, or report the error in plain text pergetNodeByName(java.lang.String, org.kohsuke.stapler.StaplerResponse2)andHttpServletResponse.setStatus(int)(HttpServletResponse.SC_NOT_FOUND).
Rationale: In practice, agents may get lost on the Jenkins controller server side due to networking issues or Jenkins controller JVM or hardware/OS lags. Then they can end up being removed from the list of agents running current builds or available for new ones. In the meanwhile, the actual agent (hudson.plugins.swarm.SwarmClientin theclientpart ofswarm-plugincode base) may still think that it is connected and available for new builds; it may still be running child processes it was requested to before the unilateral disconnection.
The-keepAliveIntervalparameter (off by default) of the agent controls how often the running agent pings the controller to (re-)confirm its status as seen by the controller, and would try to reconnect if needed.- Throws:
IOException
-
doAddSlaveLabels
@POST public void doAddSlaveLabels(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String name, @QueryParameter String labels) throws IOException Add labels to an agent.- Throws:
IOException
-
doRemoveSlaveLabels
@POST public void doRemoveSlaveLabels(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String name, @QueryParameter String labels) throws IOException Remove labels from an agent.- Throws:
IOException
-
doCreateSlave
@POST public void doCreateSlave(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, @QueryParameter String name, @QueryParameter(fixEmpty=true) String description, @QueryParameter int executors, @QueryParameter String remoteFsRoot, @QueryParameter String labels, @QueryParameter Node.Mode mode, @QueryParameter(fixEmpty=true) String hash, @QueryParameter boolean deleteExistingClients, @QueryParameter boolean keepDisconnectedClients) throws IOException Add a new Swarm agent.- Throws:
IOException
-