Class 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:
  • 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 - - JCloudsNodeMetadata
      labelString - - Label(s) for this slave.
      description - - Description of this slave.
      numExecutors - - Number of executors for this slave.
      stopOnTerminate - - if true, 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 - - if true, 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 node
      preferredAddress - - The preferred Address expression to connect to
      useJnlp - - if true, the final ssh connection attempt will be skipped.
      jnlpProvisioning - - if true, 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

      protected Object readResolve()
      Overrides:
      readResolve in class Slave
    • handleJnlpProvisioning

      public String handleJnlpProvisioning(@NonNull String hash)
      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

      public NodeMetadata getNodeMetaData()
      Get Jclouds NodeMetadata associated with this Slave.
      Returns:
      NodeMetadata
    • getJvmOptions

      public String getJvmOptions()
      Get Jclouds Custom JVM Options associated with this Slave.
      Returns:
      jvmOptions
    • getPreferredAddress

      public String getPreferredAddress()
    • getJnlpProvisioning

      public boolean getJnlpProvisioning()
    • getUseJnlp

      public boolean getUseJnlp()
    • getJnlpProvisioningNonce

      public String getJnlpProvisioningNonce()
    • getCredentials

      public LoginCredentials getCredentials()
      Get Jclouds LoginCredentials associated with this Slave.

      If Jclouds doesn't provide credentials, use stored ones.

      Returns:
      LoginCredentials
    • setOverrideRetentionTime

      public void setOverrideRetentionTime(Integer value)
    • 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

      public String 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

      public void setJnlpProvisioningNonce(String value)
    • getCredentialsId

      public String getCredentialsId()
    • createComputer

      public AbstractCloudComputer<JCloudsSlave> createComputer()
      Specified by:
      createComputer in class AbstractCloudSlave
    • getId

      @Nullable public org.jenkinsci.plugins.cloudstats.ProvisioningActivity.Id getId()
      Specified by:
      getId in interface org.jenkinsci.plugins.cloudstats.TrackedItem
    • _terminate

      protected void _terminate(TaskListener listener) throws IOException, InterruptedException
      Destroy the node. If stopOnTerminate is true, calls ComputeService.suspendNode(java.lang.String), otherwise ComputeService.destroyNode(java.lang.String).
      Specified by:
      _terminate in class AbstractCloudSlave
      Throws:
      IOException
      InterruptedException
    • waitForPhoneHome

      public void waitForPhoneHome(PrintStream logger) throws InterruptedException
      Throws:
      InterruptedException