public class NodePoolSlave
extends hudson.model.Slave
Modifier and Type | Class and Description |
---|---|
static class |
NodePoolSlave.NodePoolSlaveDescriptor
It makes jelly rendering on the node configuration page happy to have this defined.
|
hudson.model.Slave.JnlpJar, hudson.model.Slave.SlaveDescriptor
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_HOLD_DURATION_MS
The default hold duration expressed in milliseconds.
|
static String |
DEFAULT_HOLD_UNTIL_VALUE |
static long |
MAX_HOLD_DURATION_MS
The maximum hold duration currently allowed expressed in milliseconds.
|
Constructor and Description |
---|
NodePoolSlave(NodePoolNode nodePoolNode,
String credentialsId,
NodePoolJob npj,
String jdkHome,
String jdkInstallationScript)
Create a new slave
|
Modifier and Type | Method and Description |
---|---|
hudson.model.Computer |
createComputer()
Returns a new computer based on the nodepool node object associated with this class instance.
|
String |
getBuildUrl() |
hudson.model.Slave.SlaveDescriptor |
getDescriptor() |
String |
getHoldReason()
Returns the hold reason value.
|
long |
getHoldUnitEpochMs()
Returns the hold until time as the number of milliseconds since epoch.
|
String |
getHoldUntil()
Returns the hold until string value.
|
String |
getHoldUntilTimeFormatted()
Returns the hold until time formatted as a UTC ISO date/time.
|
String |
getHoldUser()
Returns the user requesting the hold.
|
NodePoolJob |
getJob()
Get the NodePoolJob this slave was created for
|
NodePoolJob |
getNodePoolJob()
Get a reference to the nodepoolJob related to this agent
|
NodePoolNode |
getNodePoolNode() |
Boolean |
isFinished() |
boolean |
isHeld()
If true, hold onto the node after the associated build is completed.
|
hudson.model.Node |
reconfigure(org.kohsuke.stapler.StaplerRequest req,
net.sf.json.JSONObject form)
This gets invoked when the user clicks "Save" while editing the "Node" in the UI.
|
void |
removeHoldUntil()
Removes the node hold until time.
|
void |
setHeld(boolean held)
Set to true in order to hold the node after the build is completed.
|
void |
setHoldReason(String holdReason)
Sets the hold reason value.
|
void |
setHoldUntil(String holdUntil,
boolean resetHoldUntil)
Sets the hold until value which represents a duration encoded as: 1h, 2d, 3w, 6m format.
|
void |
setHoldUntilEpochMs(long holdUntilEpochMs)
Sets the hold until time as the number of milliseconds since epoch.
|
void |
setHoldUser(String holdUser)
Sets the user id for the user requesting the node hold.
|
createLauncher, equals, getClockDifferenceCallable, getComputer, getLabelString, getLauncher, getMode, getNodeDescription, getNodeName, getNodeProperties, getNumExecutors, getRemoteFS, getRetentionStrategy, getRootPath, getUserId, getWorkspaceFor, getWorkspaceRoot, hashCode, readResolve, setLabelString, setLauncher, setMode, setNodeDescription, setNodeName, setNodeProperties, setNumExecutors, setRetentionStrategy, setUserId, toString
canTake, canTake, createPath, getACL, getAssignedLabels, getChannel, getClockDifference, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getSearchUrl, getSelfLabel, isAcceptingTasks, isHoldOffLaunchUntilSave, save, toComputer
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
public static final String DEFAULT_HOLD_UNTIL_VALUE
public static final long DEFAULT_HOLD_DURATION_MS
public static final long MAX_HOLD_DURATION_MS
@DataBoundConstructor public NodePoolSlave(NodePoolNode nodePoolNode, String credentialsId, NodePoolJob npj, String jdkHome, String jdkInstallationScript) throws hudson.model.Descriptor.FormException, IOException
nodePoolNode
- the node from NodePoolcredentialsId
- the Jenkins credential identifiernpj
- The job this slave/agent was created forjdkHome
- the JDK home folderjdkInstallationScript
- the script for installing the JDKDescriptor.FormException
- on configuration exceptionIOException
- on configuration exceptionpublic NodePoolJob getJob()
public NodePoolNode getNodePoolNode()
public String getBuildUrl()
public hudson.model.Computer createComputer()
createComputer
in class hudson.model.Slave
public hudson.model.Node reconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject form) throws hudson.model.Descriptor.FormException
reconfigure
in interface hudson.model.ReconfigurableDescribable<hudson.model.Node>
reconfigure
in class hudson.model.Node
req
- stapler requestform
- form data to update slave withDescriptor.FormException
- if things go sidewayspublic boolean isHeld()
public void setHeld(boolean held)
held
- whether to hold the node after the build completespublic String getHoldReason()
public void setHoldReason(String holdReason)
holdReason
- the hold reason - typically a justification for the hold.public String getHoldUser()
public void setHoldUser(String holdUser)
holdUser
- the user id of the user requesting the node holdpublic String getHoldUntil()
public NodePoolJob getNodePoolJob()
public void setHoldUntil(String holdUntil, boolean resetHoldUntil)
If the hold until value has NOT changed from the previous value and the reset hold until is false then the existing hold until value will not change and remain as previously calculated.
If the the reset hold flag is true it will recalculate the hold until time based on the current time (hold until = current time + hold until time duration - example: * hold until = now + 1d).
Scenarios:
holdUntil
- the hold until string valueresetHoldUntil
- flag to indicate if we should extend/renew/reset the hold until time. If true, will reset
the hold until value to the specified duration from the current
time. Otherwise, if the hold util value is the same it will leave the existing hold until
time unchanged.public void removeHoldUntil()
public long getHoldUnitEpochMs()
public void setHoldUntilEpochMs(long holdUntilEpochMs)
holdUntilEpochMs
- the hold until time as the number of milliseconds since epoch.public String getHoldUntilTimeFormatted()
public hudson.model.Slave.SlaveDescriptor getDescriptor()
getDescriptor
in interface hudson.model.Describable<hudson.model.Node>
getDescriptor
in class hudson.model.Slave
public Boolean isFinished()
Copyright © 2016–2018. All rights reserved.