Class JCloudsSlave

    • Field Detail

      • stopOnTerminate

        public final boolean stopOnTerminate
    • Constructor Detail

      • 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.
    • Method Detail

      • 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()
      • getId

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