Class NodeParameterDefinition
- java.lang.Object
-
- hudson.model.ParameterDefinition
-
- hudson.model.SimpleParameterDefinition
-
- org.jvnet.jenkins.plugins.nodelabelparameter.NodeParameterDefinition
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<ParameterDefinition>
,Serializable
,MultipleNodeDescribingParameterDefinition
public class NodeParameterDefinition extends SimpleParameterDefinition implements MultipleNodeDescribingParameterDefinition
Defines a build parameter used to select the node where a job should be executed. Although it is possible to define the node name in the UI at "restrict where this job should run", but that would tie a job to a specific node. This parameter actually allows a list of possible nodes and asks the user before execution.- Author:
- Dominik Bartholdi (imod)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NodeParameterDefinition.DescriptorImpl
-
Nested classes/interfaces inherited from class hudson.model.ParameterDefinition
ParameterDefinition.ParameterDescriptor
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description List<String>
allowedSlaves
String
defaultValue
Deprecated.-
Fields inherited from class hudson.model.ParameterDefinition
LIST
-
-
Constructor Summary
Constructors Constructor Description NodeParameterDefinition(String name, String description, String defaultValue, List<String> allowedAgents, String triggerIfResult)
Deprecated.NodeParameterDefinition(String name, String description, List<String> defaultAgents, List<String> allowedAgents, String triggerIfResult, boolean ignoreOfflineNodes)
Deprecated.NodeParameterDefinition(String name, String description, List<String> defaultSlaves, List<String> allowedSlaves, String triggerIfResult, NodeEligibility nodeEligibility)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterDefinition
copyWithDefaultValue(ParameterValue defaultValueObj)
TriggerNextBuildWrapper
createBuildWrapper()
Returns the wrapper to trigger the next buildParameterValue
createValue(String value)
ParameterValue
createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
List<String>
getAllowedNodesOrAll()
Returns a list of nodes the job could run on.boolean
getAllowMultiNodeSelection()
NodeParameterValue
getDefaultParameterValue()
e.g.List<String>
getDefaultSlaves()
NodeEligibility
getNodeEligibility()
gets the strategy which decides whether a node should be ignored or notstatic List<String>
getSlaveNames()
Gets the names of all configured agents, regardless whether they are online.static List<String>
getSlaveNamesForSelection()
returns all available nodes plus an identifier to identify all agents at position one.String
getTriggerIfResult()
Get the requested build result definitionboolean
isTriggerConcurrentBuilds()
Object
readResolve()
void
validateBuild(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
Callback to allow the parameter definition to do a final validation if everything is OK to proceed.-
Methods inherited from class hudson.model.SimpleParameterDefinition
createValue, createValue
-
Methods inherited from class hudson.model.ParameterDefinition
all, equals, getDescription, getDescriptor, getFormattedDescription, getName, getType, hashCode, isValid, setDescription
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jvnet.jenkins.plugins.nodelabelparameter.MultipleNodeDescribingParameterDefinition
getName
-
-
-
-
Field Detail
-
defaultValue
@Deprecated public transient String defaultValue
Deprecated.
-
-
Constructor Detail
-
NodeParameterDefinition
@DataBoundConstructor public NodeParameterDefinition(String name, String description, List<String> defaultSlaves, List<String> allowedSlaves, String triggerIfResult, NodeEligibility nodeEligibility)
-
NodeParameterDefinition
@Deprecated public NodeParameterDefinition(String name, String description, List<String> defaultAgents, List<String> allowedAgents, String triggerIfResult, boolean ignoreOfflineNodes)
Deprecated.
-
-
Method Detail
-
getDefaultParameterValue
public NodeParameterValue getDefaultParameterValue()
e.g. what to show if a build is triggered by hand?- Overrides:
getDefaultParameterValue
in classParameterDefinition
-
createValue
public ParameterValue createValue(String value)
- Specified by:
createValue
in classSimpleParameterDefinition
-
copyWithDefaultValue
public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValueObj)
- Overrides:
copyWithDefaultValue
in classParameterDefinition
-
getAllowedNodesOrAll
public List<String> getAllowedNodesOrAll()
Returns a list of nodes the job could run on. If allowed nodes is empty, it falls back to all nodes- Returns:
- list of nodenames.
-
getTriggerIfResult
public String getTriggerIfResult()
Description copied from interface:MultipleNodeDescribingParameterDefinition
Get the requested build result definition- Specified by:
getTriggerIfResult
in interfaceMultipleNodeDescribingParameterDefinition
- Returns:
- the triggerIfResult
-
getNodeEligibility
public NodeEligibility getNodeEligibility()
Description copied from interface:MultipleNodeDescribingParameterDefinition
gets the strategy which decides whether a node should be ignored or not- Specified by:
getNodeEligibility
in interfaceMultipleNodeDescribingParameterDefinition
- Returns:
- the eligibility definition
-
getSlaveNamesForSelection
public static List<String> getSlaveNamesForSelection()
returns all available nodes plus an identifier to identify all agents at position one.- Returns:
- list of node names
-
getSlaveNames
public static List<String> getSlaveNames()
Gets the names of all configured agents, regardless whether they are online.- Returns:
- list with all agent names
-
validateBuild
public void validateBuild(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener)
Description copied from interface:MultipleNodeDescribingParameterDefinition
Callback to allow the parameter definition to do a final validation if everything is OK to proceed. Implementations are asked to throw a runtime exception if something is not OK and the build should be stopped.- Specified by:
validateBuild
in interfaceMultipleNodeDescribingParameterDefinition
- Parameters:
build
- build to be validatedlauncher
- build launcherlistener
- provides access to the log stream
-
createValue
public ParameterValue createValue(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject jo)
- Specified by:
createValue
in classParameterDefinition
-
getAllowMultiNodeSelection
public boolean getAllowMultiNodeSelection()
- Returns:
- the allowMultiNodeSelection
-
isTriggerConcurrentBuilds
public boolean isTriggerConcurrentBuilds()
- Returns:
- the triggerConcurrentBuilds
-
readResolve
public Object readResolve()
-
createBuildWrapper
public TriggerNextBuildWrapper createBuildWrapper()
Description copied from interface:MultipleNodeDescribingParameterDefinition
Returns the wrapper to trigger the next build- Specified by:
createBuildWrapper
in interfaceMultipleNodeDescribingParameterDefinition
- Returns:
null
if there is no new build to be triggered.
-
-