Package hudson.plugins.sshslaves
Class SSHLauncher
java.lang.Object
hudson.model.AbstractDescribableImpl<ComputerLauncher>
hudson.slaves.ComputerLauncher
hudson.plugins.sshslaves.SSHLauncher
- All Implemented Interfaces:
ExtensionPoint,Describable<ComputerLauncher>
A computer launcher that tries to start a linux agent by opening an SSH connection and trying to find java.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Integerstatic final Integerstatic final Integerstatic final intstatic final Stringstatic final StringField javaPath.Field launchTimeoutSeconds.Field maxNumRetries.Field prefixStartSlaveCmd.Field retryWaitTime (seconds).static final Stringstatic final com.cloudbees.plugins.credentials.domains.SchemeRequirementThe scheme requirement.Field suffixStartSlaveCmd.static final StringFields inherited from class hudson.slaves.ComputerLauncher
LIST -
Constructor Summary
ConstructorsConstructorDescriptionSSHLauncher(String host, int port, String credentialsId) Constructor SSHLauncher creates a new SSHLauncher instance.SSHLauncher(String host, int port, String credentialsId, String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd, Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime, SshHostKeyVerificationStrategy sshHostKeyVerificationStrategy) Constructor SSHLauncher creates a new SSHLauncher instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterDisconnect(SlaveComputer slaveComputer, TaskListener listener) com.trilead.ssh2.Connectioncom.cloudbees.plugins.credentials.common.StandardUsernameCredentialsgetHost()Getter for property 'host'.Deprecated.Gets the optional JVM Options used to launch the agent JVM.Getter for property 'launchTimeoutSeconds'Getter for property 'maxNumRetries'intgetPort()Getter for property 'port'.Getter for property 'retryWaitTime'booleanstatic StringGets the formatted current time stamp.booleanEnable/Disable the credential tracking, this tracking store information about where it is used a credential, in this case in a node.getWorkDirParam(String workingDirectory) static StringgetWorkingDirectory(SlaveComputer computer) Returns the remote root workspace (without trailing slash).booleanvoidlaunch(SlaveComputer computer, TaskListener listener) static com.cloudbees.plugins.credentials.common.StandardUsernameCredentialslookupSystemCredentials(String credentialsId) protected voidopenConnection(TaskListener listener, SlaveComputer computer) protected voidreportEnvironment(TaskListener listener) voidvoidsetJavaPath(String value) voidsetJvmOptions(String value) voidsetLaunchTimeoutSeconds(Integer value) voidsetMaxNumRetries(Integer value) voidsetPort(int value) voidsetPrefixStartSlaveCmd(String value) voidsetRetryWaitTime(Integer value) voidvoidsetSuffixStartSlaveCmd(String value) voidsetTcpNoDelay(boolean tcpNoDelay) voidsetWorkDir(String workDir) Methods inherited from class hudson.slaves.ComputerLauncher
afterDisconnect, beforeDisconnect, beforeDisconnect, checkJavaVersion, launchMethods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Field Details
-
SSH_SCHEME
public static final com.cloudbees.plugins.credentials.domains.SchemeRequirement SSH_SCHEMEThe scheme requirement. -
DEFAULT_MAX_NUM_RETRIES
-
DEFAULT_RETRY_WAIT_TIME
-
DEFAULT_LAUNCH_TIMEOUT_SECONDS
-
AGENT_JAR
- See Also:
-
SLASH_AGENT_JAR
- See Also:
-
WORK_DIR_PARAM
- See Also:
-
JAR_CACHE_PARAM
- See Also:
-
JAR_CACHE_DIR
- See Also:
-
DEFAULT_SSH_PORT
public static final int DEFAULT_SSH_PORT- See Also:
-
javaPath
Field javaPath. -
prefixStartSlaveCmd
Field prefixStartSlaveCmd. -
suffixStartSlaveCmd
Field suffixStartSlaveCmd. -
launchTimeoutSeconds
Field launchTimeoutSeconds. -
maxNumRetries
Field maxNumRetries. -
retryWaitTime
Field retryWaitTime (seconds).
-
-
Constructor Details
-
SSHLauncher
public SSHLauncher(@NonNull String host, int port, String credentialsId, String jvmOptions, String javaPath, String prefixStartSlaveCmd, String suffixStartSlaveCmd, Integer launchTimeoutSeconds, Integer maxNumRetries, Integer retryWaitTime, @CheckForNull SshHostKeyVerificationStrategy sshHostKeyVerificationStrategy) Constructor SSHLauncher creates a new SSHLauncher instance.- Parameters:
host- The host to connect to.port- The port to connect on.credentialsId- The credentials id to connect as.jvmOptions- Options passed to the java vm.javaPath- Path to the host jdk installation. Ifnullthe jdk will be auto detected.prefixStartSlaveCmd- This will prefix the start agent command. For instance if you want to execute the command with a different shell.suffixStartSlaveCmd- This will suffix the start agent command.launchTimeoutSeconds- Launch timeout in secondsmaxNumRetries- The number of times to retry connection if the SSH connection is refused during initial connectretryWaitTime- The number of seconds to wait between retriessshHostKeyVerificationStrategy- Host key verification method selected.
-
SSHLauncher
Constructor SSHLauncher creates a new SSHLauncher instance.- Parameters:
host- The host to connect to.port- The port to connect on.credentialsId- The credentials id to connect as.
-
-
Method Details
-
lookupSystemCredentials
public static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials lookupSystemCredentials(String credentialsId) -
readResolve
-
getCredentials
public com.cloudbees.plugins.credentials.common.StandardUsernameCredentials getCredentials() -
isLaunchSupported
public boolean isLaunchSupported()- Overrides:
isLaunchSupportedin classComputerLauncher
-
getJvmOptions
Gets the optional JVM Options used to launch the agent JVM.- Returns:
- The optional JVM Options used to launch the agent JVM.
-
getJavaPath
Deprecated.Gets the optional java command to use to launch the agent JVM.- Returns:
- The optional java command to use to launch the agent JVM.
-
getTimestamp
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String getTimestamp()Gets the formatted current time stamp.- Returns:
- the formatted current time stamp.
-
getWorkingDirectory
Returns the remote root workspace (without trailing slash).- Parameters:
computer- The computer to get the root workspace of.- Returns:
- the remote root workspace (without trailing slash).
-
launch
- Overrides:
launchin classComputerLauncher- Throws:
InterruptedException
-
reportEnvironment
- Throws:
IOExceptionInterruptedException
-
openConnection
protected void openConnection(TaskListener listener, SlaveComputer computer) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
afterDisconnect
- Overrides:
afterDisconnectin classComputerLauncher
-
getCredentialsId
-
getSshHostKeyVerificationStrategy
-
setSshHostKeyVerificationStrategy
@DataBoundSetter public void setSshHostKeyVerificationStrategy(@CheckForNull SshHostKeyVerificationStrategy value) -
setJvmOptions
-
setJavaPath
-
setPrefixStartSlaveCmd
-
setSuffixStartSlaveCmd
-
setMaxNumRetries
-
setLaunchTimeoutSeconds
-
setRetryWaitTime
-
setPort
public void setPort(int value) -
setHost
-
getHost
Getter for property 'host'.- Returns:
- Value for property 'host'.
-
getPort
public int getPort()Getter for property 'port'.- Returns:
- Value for property 'port'.
-
getConnection
public com.trilead.ssh2.Connection getConnection() -
getPrefixStartSlaveCmd
-
getSuffixStartSlaveCmd
-
getLaunchTimeoutSeconds
Getter for property 'launchTimeoutSeconds'- Returns:
- launchTimeoutSeconds
-
getMaxNumRetries
Getter for property 'maxNumRetries'- Returns:
- maxNumRetries
-
getRetryWaitTime
Getter for property 'retryWaitTime'- Returns:
- retryWaitTime
-
getTcpNoDelay
public boolean getTcpNoDelay() -
setTcpNoDelay
@DataBoundSetter public void setTcpNoDelay(boolean tcpNoDelay) -
getTrackCredentials
public boolean getTrackCredentials()Enable/Disable the credential tracking, this tracking store information about where it is used a credential, in this case in a node. If the tracking is enabled and you launch a big number of Agents per day, activate credentials tacking could cause a performance issue see- See Also:
-
getWorkDir
-
setWorkDir
-
getWorkDirParam
@NonNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public String getWorkDirParam(@NonNull String workingDirectory) - Parameters:
workingDirectory- The Working directory set on the configuration of the node.- Returns:
- the remoting parameter to set the workDir, by default it is the same as the working directory configured on the node so "-workDir " + workingDirectory, if workDir is set, he method will return "-workDir " + getWorkDir() if the parameter is set in suffixStartSlaveCmd, the method will return an empty String.
-
logConfiguration
-