Class NodeProperty<N extends Node>
- Type Parameters:
N
-NodeProperty
can choose to only work with a certain subtype ofNode
, and this 'N' represents that type. Also seePropertyDescriptor.isApplicable(Class)
.
- All Implemented Interfaces:
ExtensionPoint
,Describable<NodeProperty<?>>
,ReconfigurableDescribable<NodeProperty<?>>
- Direct Known Subclasses:
DiskSpaceMonitorNodeProperty
,EnvironmentVariablesNodeProperty
,ToolLocationNodeProperty
Node
.
Plugins can contribute this extension point to add additional data to Node
.
NodeProperty
s show up in the configuration screen of a node, and they are persisted with the Node
object.
To add UI action to Node
s, i.e. a new link shown in the left side menu on a node page (./computer/<a node>
), see instead TransientComputerActionFactory
.
Views
- config.jelly
- Added to the configuration page of the node.
- global.jelly
- Added to the system configuration page.
- summary.jelly (optional)
- Added to the index page of the
Computer
associated with the node
- Since:
- 1.286
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionall()
Lists up all the registeredNodeDescriptor
s in the system.void
buildEnvVars
(EnvVars env, TaskListener listener) Creates environment variable override for launching child processes in this node.canTake
(Queue.BuildableItem item) Called by theNode
to help determine whether or not it should take the given task.canTake
(Queue.Task task) Deprecated.static List<NodePropertyDescriptor>
List up allNodePropertyDescriptor
s that are applicable for the given project.Gets the descriptor for this instance.NodeProperty<?>
reconfigure
(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject form) When a parent/owner object of a Describable gets a config form submission and instances are recreated, this method is invoked on the existing instance (meaning the 'this' reference points to the existing instance) to create a new instance to be added to the parent/owner object.NodeProperty<?>
reconfigure
(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject form) Deprecated.protected void
setUp
(AbstractBuild build, Launcher launcher, BuildListener listener) Runs before theSCM.checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)
runs, and performs a set up.
-
Field Details
-
node
-
-
Constructor Details
-
NodeProperty
public NodeProperty()
-
-
Method Details
-
setNode
-
getDescriptor
Description copied from interface:Describable
Gets the descriptor for this instance.Descriptor
is a singleton for every concreteDescribable
implementation, so ifa.getClass() == b.getClass()
then by defaulta.getDescriptor() == b.getDescriptor()
as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)- Specified by:
getDescriptor
in interfaceDescribable<N extends Node>
-
canTake
Deprecated.as of 1.413 UsecanTake(Queue.BuildableItem)
Called by theNode
to help determine whether or not it should take the given task. Individual properties can return a non-null value here if there is some reason the given task should not be run on its associated node. By default, this method returnsnull
.- Since:
- 1.360
-
canTake
Called by theNode
to help determine whether or not it should take the given task. Individual properties can return a non-null value here if there is some reason the given task should not be run on its associated node. By default, this method returnsnull
.- Since:
- 1.413
-
setUp
public Environment setUp(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException Runs before theSCM.checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)
runs, and performs a set up. Can contribute additional properties to the environment.- Parameters:
build
- The build in progress for which anEnvironment
object is created. Never null.launcher
- This launcher can be used to launch processes for this build. If the build runs remotely, launcher will also run a job on that remote machine. Never null.listener
- Can be used to send any message.- Returns:
- non-null if the build can continue, null if there was an error and the build needs to be aborted.
- Throws:
IOException
- terminates the build abnormally. Hudson will handle the exception and reports a nice error message.InterruptedException
-
buildEnvVars
public void buildEnvVars(@NonNull EnvVars env, @NonNull TaskListener listener) throws IOException, InterruptedException Creates environment variable override for launching child processes in this node.Whereas
setUp(AbstractBuild, Launcher, BuildListener)
is used specifically for executing builds, this method is used for other process launch activities that happens outside the context of a build, such as polling, one time action (tagging, deployment, etc.)Starting 1.489, this method and
setUp(AbstractBuild, Launcher, BuildListener)
are layered properly. That is, for launching processes for a build, this method is called first and thenEnvironment.buildEnvVars(Map)
will be added on top. This allows implementations to put node-scoped environment variables here, then build scoped variables tosetUp(AbstractBuild, Launcher, BuildListener)
.Unfortunately, Jenkins core earlier than 1.488 only calls
setUp(AbstractBuild, Launcher, BuildListener)
, so if the backward compatibility with these earlier versions is important, implementations should invoke this method fromEnvironment.buildEnvVars(Map)
.- Parameters:
env
- Manipulate this variable (normally by adding more entries.) Note that this is an override, so it doesn't contain environment variables that are currently set for the agent process itself.listener
- Can be used to send messages.- Throws:
IOException
InterruptedException
- Since:
- 1.489
-
reconfigure
public NodeProperty<?> reconfigure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject form) throws Descriptor.FormException Description copied from interface:ReconfigurableDescribable
When a parent/owner object of a Describable gets a config form submission and instances are recreated, this method is invoked on the existing instance (meaning the 'this' reference points to the existing instance) to create a new instance to be added to the parent/owner object.The default implementation of this should be the following:
return form==null ? null : getDescriptor().newInstance(req, form);
- Specified by:
reconfigure
in interfaceReconfigurableDescribable<N extends Node>
- Parameters:
req
- The current HTTP request being processed.form
- JSON fragment that corresponds to this describable object. If the newly submitted form doesn't include a fragment for this describable (meaning the user has de-selected your descriptor), then this argument is null.- Returns:
- The new instance. To not to create an instance of a describable, return null.
- Throws:
Descriptor.FormException
-
reconfigure
@Deprecated public NodeProperty<?> reconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject form) throws Descriptor.FormException Deprecated.- Specified by:
reconfigure
in interfaceReconfigurableDescribable<N extends Node>
- Throws:
Descriptor.FormException
-
all
Lists up all the registeredNodeDescriptor
s in the system. -
for_
List up allNodePropertyDescriptor
s that are applicable for the given project.
-
canTake(Queue.BuildableItem)