Package jenkins.plugins.jclouds.compute
Class JCloudsSlave
java.lang.Object
hudson.model.AbstractModelObject
hudson.model.Node
hudson.model.Slave
hudson.slaves.AbstractCloudSlave
jenkins.plugins.jclouds.compute.JCloudsSlave
- All Implemented Interfaces:
ExtensionPoint
,Describable<Node>
,ModelObject
,ReconfigurableDescribable<Node>
,Saveable
,SearchableModelObject
,SearchItem
,AccessControlled
,Serializable
,OnMaster
,org.jenkinsci.plugins.cloudstats.TrackedItem
public class JCloudsSlave
extends AbstractCloudSlave
implements org.jenkinsci.plugins.cloudstats.TrackedItem
Jenkins Slave node - managed by JClouds.
- Author:
- Vijay Kiran
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Slave
Slave.JnlpJar, Slave.SlaveDescriptor
Nested classes/interfaces inherited from class hudson.model.Node
Node.InternalComputerListener, Node.Mode
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Fields inherited from class hudson.model.Node
holdOffLaunchUntilSave, SKIP_BUILD_CHECK_ON_FLYWEIGHTS
-
Constructor Summary
ConstructorDescriptionJCloudsSlave
(String cloudName, String name, String nodeDescription, String remoteFS, String numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties, boolean stopOnTerminate, Integer overrideRetentionTime, String user, String password, String privateKey, boolean authSudo, String jvmOptions, boolean waitPhoneHome, int waitPhoneHomeTimeout, String credentialsId, String preferredAddress, boolean useJnlp, boolean jnlpProvisioning, String jnlpProvisioningNonce) JCloudsSlave
(String cloudName, String fsRoot, NodeMetadata metadata, String labelString, String description, String numExecutors, boolean stopOnTerminate, Integer overrideRetentionTime, String jvmOptions, boolean waitPhoneHome, int waitPhoneHomeTimeout, String credentialsId, Node.Mode mode, String preferredAddress, boolean useJnlp, boolean jnlpProvisioning, String jnlpProvisioningNonce) Constructs a new slave from JCloud's NodeMetadataJCloudsSlave
(org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id provisioningId, String cloudName, String fsRoot, NodeMetadata metadata, String labelString, String description, String numExecutors, boolean stopOnTerminate, Integer overrideRetentionTime, String jvmOptions, boolean waitPhoneHome, int waitPhoneHomeTimeout, String credentialsId, Node.Mode mode, String preferredAddress, boolean useJnlp, boolean jnlpProvisioning, String jnlpProvisioningNonce) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_terminate
(TaskListener listener) Destroy the node.Get the JClouds profile identifier for the Cloud associated with this slave.Get Jclouds LoginCredentials associated with this Slave.org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id
getId()
boolean
Get Jclouds Custom JVM Options associated with this Slave.Get Jclouds NodeMetadata associated with this Slave.int
Get the retention time for this slave, defaulting to the parent cloud's if not set.boolean
handleJnlpProvisioning
(String hash) Handles JNLP provisioning request from slave.boolean
boolean
void
Publishes JNLP metadata to the virtual machine.protected Object
void
setJnlpProvisioningNonce
(String value) void
setOverrideRetentionTime
(Integer value) void
setPendingDelete
(boolean pendingDelete) void
setWaitPhoneHome
(boolean value) void
waitForPhoneHome
(PrintStream logger) Methods inherited from class hudson.slaves.AbstractCloudSlave
terminate
Methods inherited from class hudson.model.Slave
createLauncher, equals, getClockDifferenceCallable, getComputer, getDescriptor, getLabelAtomSet, getLabelString, getLauncher, getMode, getNodeDescription, getNodeName, getNodeProperties, getNumExecutors, getRemoteFS, getRetentionStrategy, getRootPath, getUserId, getWorkspaceFor, getWorkspaceRoot, hashCode, setLabelString, setLauncher, setMode, setNodeDescription, setNodeName, setNodeProperties, setNumExecutors, setRetentionStrategy, setUserId, toString
Methods inherited from class hudson.model.Node
canTake, canTake, createPath, getACL, getAssignedLabels, getChannel, getClockDifference, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getSearchUrl, getSelfLabel, getTemporaryOfflineCause, isAcceptingTasks, isHoldOffLaunchUntilSave, reconfigure, save, toComputer
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
-
Field Details
-
stopOnTerminate
public final boolean stopOnTerminate
-
-
Constructor Details
-
JCloudsSlave
@DataBoundConstructor public JCloudsSlave(String cloudName, String name, String nodeDescription, String remoteFS, String numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties, boolean stopOnTerminate, Integer overrideRetentionTime, String user, String password, String privateKey, boolean authSudo, String jvmOptions, boolean waitPhoneHome, int waitPhoneHomeTimeout, String credentialsId, String preferredAddress, boolean useJnlp, boolean jnlpProvisioning, String jnlpProvisioningNonce) throws Descriptor.FormException, IOException - Throws:
Descriptor.FormException
IOException
-
JCloudsSlave
public JCloudsSlave(String cloudName, String fsRoot, NodeMetadata metadata, String labelString, String description, String numExecutors, boolean stopOnTerminate, Integer overrideRetentionTime, String jvmOptions, boolean waitPhoneHome, int waitPhoneHomeTimeout, String credentialsId, Node.Mode mode, String preferredAddress, boolean useJnlp, boolean jnlpProvisioning, String jnlpProvisioningNonce) throws IOException, Descriptor.FormException Constructs a new slave from JCloud's NodeMetadata- Parameters:
cloudName
- - the name of the cloud that's provisioning this slave.fsRoot
- - Location of Jenkins root (homedir) on the slave.metadata
- - JCloudsNodeMetadatalabelString
- - Label(s) for this slave.description
- - Description of this slave.numExecutors
- - Number of executors for this slave.stopOnTerminate
- - iftrue
, suspend the slave rather than terminating it.overrideRetentionTime
- - Retention time to use specifically for this slave, overriding the cloud default.jvmOptions
- - Custom options for lauching the JVM on the slave.waitPhoneHome
- - iftrue
, delay initial SSH connect until slave has "phoned home" back to jenkins.waitPhoneHomeTimeout
- - Timeout in minutes util giving up waiting for the "phone home" POST.credentialsId
- - Id of the credentials in Jenkin's global credentials database.mode
- - Jenkins usage mode for this nodepreferredAddress
- - The preferred Address expression to connect touseJnlp
- - iftrue
, the final ssh connection attempt will be skipped.jnlpProvisioning
- - iftrue
, enables JNLP provisioning.jnlpProvisioningNonce
- - nonce, used to authenticate provisioning requests via JnlpProvisionWebHook.- Throws:
IOException
- if an error occurs.Descriptor.FormException
- if the form does not validate.
-
JCloudsSlave
public JCloudsSlave(org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id provisioningId, String cloudName, String fsRoot, NodeMetadata metadata, String labelString, String description, String numExecutors, boolean stopOnTerminate, Integer overrideRetentionTime, String jvmOptions, boolean waitPhoneHome, int waitPhoneHomeTimeout, String credentialsId, Node.Mode mode, String preferredAddress, boolean useJnlp, boolean jnlpProvisioning, String jnlpProvisioningNonce) throws IOException, Descriptor.FormException - Throws:
IOException
Descriptor.FormException
-
-
Method Details
-
readResolve
- Overrides:
readResolve
in classSlave
-
handleJnlpProvisioning
Handles JNLP provisioning request from slave.- Parameters:
hash
- The authentication hash, provided in the client's request- Returns:
- The parameters for establishing a Jnlp connection as JSON response. An empty string, if the provided hash is incorrect.
-
publishJnlpMetaData
public void publishJnlpMetaData()Publishes JNLP metadata to the virtual machine. -
getNodeMetaData
Get Jclouds NodeMetadata associated with this Slave.- Returns:
NodeMetadata
-
getJvmOptions
Get Jclouds Custom JVM Options associated with this Slave.- Returns:
- jvmOptions
-
getPreferredAddress
-
getJnlpProvisioning
public boolean getJnlpProvisioning() -
getUseJnlp
public boolean getUseJnlp() -
getJnlpProvisioningNonce
-
getCredentials
Get Jclouds LoginCredentials associated with this Slave.If Jclouds doesn't provide credentials, use stored ones.
- Returns:
LoginCredentials
-
setOverrideRetentionTime
-
getRetentionTime
public int getRetentionTime()Get the retention time for this slave, defaulting to the parent cloud's if not set. Sometime parent cloud cannot be determined (returns Null as I see), in which case this method will return default value set in CloudInstanceDefaults.- Returns:
- overrideTime
- See Also:
-
CloudInstanceDefaults.DEFAULT_INSTANCE_RETENTION_TIME_IN_MINUTES
-
getCloudName
Get the JClouds profile identifier for the Cloud associated with this slave.- Returns:
- cloudName
-
isPendingDelete
public boolean isPendingDelete() -
setPendingDelete
public void setPendingDelete(boolean pendingDelete) -
isWaitPhoneHome
public boolean isWaitPhoneHome() -
setWaitPhoneHome
public void setWaitPhoneHome(boolean value) -
setJnlpProvisioningNonce
-
getCredentialsId
-
createComputer
- Specified by:
createComputer
in classAbstractCloudSlave
-
getId
@Nullable public org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id getId()- Specified by:
getId
in interfaceorg.jenkinsci.plugins.cloudstats.TrackedItem
-
_terminate
Destroy the node. If stopOnTerminate istrue
, callsComputeService.suspendNode(java.lang.String)
, otherwiseComputeService.destroyNode(java.lang.String)
.- Specified by:
_terminate
in classAbstractCloudSlave
- Throws:
IOException
InterruptedException
-
waitForPhoneHome
- Throws:
InterruptedException
-