Class ExecRemoteAgent
java.lang.Object
com.cloudbees.jenkins.plugins.sshagent.exec.ExecRemoteAgent
- All Implemented Interfaces:
Serializable
Runs a native SSH agent installed on a system.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault timeout, in minutes, applied to the agent commands when none is configured. -
Constructor Summary
ConstructorsConstructorDescriptionExecRemoteAgent(Launcher launcher, TaskListener listener) ExecRemoteAgent(Launcher launcher, TaskListener listener, int timeoutMinutes) Launches a nativessh-agent. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIdentity(String privateKey, String passphrase, String comment, FilePath ws, Launcher launcher, TaskListener listener) Adds the provided identity to the agent.getEnv()voidstop(Launcher launcher, TaskListener listener) Stops the agent.
-
Field Details
-
DEFAULT_TIMEOUT_MINUTES
public static final int DEFAULT_TIMEOUT_MINUTESDefault timeout, in minutes, applied to the agent commands when none is configured.- See Also:
-
-
Constructor Details
-
ExecRemoteAgent
public ExecRemoteAgent(Launcher launcher, TaskListener listener) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
ExecRemoteAgent
public ExecRemoteAgent(Launcher launcher, TaskListener listener, int timeoutMinutes) throws IOException, InterruptedException Launches a nativessh-agent.- Parameters:
launcher- launches the agent process.listener- for logging.timeoutMinutes- how long, in minutes, to wait for each of thessh-agent,ssh-addandssh-agent -kcommands before giving up.- Throws:
IOExceptionInterruptedException- Since:
- FIXME
-
-
Method Details
-
addIdentity
public void addIdentity(String privateKey, String passphrase, String comment, FilePath ws, Launcher launcher, TaskListener listener) throws IOException, InterruptedException Adds the provided identity to the agent.- Parameters:
privateKey- the private key.passphrase- the passphrase ornull.comment- the comment to give to the key.listener- for logging.- Throws:
IOExceptionInterruptedException
-
getEnv
-
stop
Stops the agent.Stopping is best-effort cleanup: if the
ssh-agentprocess is already gone (for example killed during a long build), a failedssh-agent -kis logged rather than thrown, so that it does not fail an otherwise successful build.- Parameters:
listener- for logging.- Throws:
IOExceptionInterruptedException
-