The plugin provides functionality to execute commands via Secure Shell (SSH) connection protocol.
It’s allowed to configure unlimited number of SSH connections via mechanism of the dynamic properties. The properties prefix example is:
ssh.server.my-server
where my-server
is a key used to refer SSH connection in the steps. The key is defined by users, it must be unique and can’t contain dots.
Creates a new dynamic SSH connection from the provided parameters, the connection is available only within the story creating the connection.
When I configure SSH connection with key `$connectionKey` and parameters:$connectionParameters
-
$connectionKey
- The key to assign to the creating SSH connection. In case if the key conflicts with a global connection key, the dynamic connection will take precedence within the story. -
$connectionParameters
- The ExamplesTable with SSH connection parameters.
When I configure SSH connection with key `my-connection` and parameters:
|username |host |port|password|
|admin |10.10.10.10|22 |Pa$$w0rd|
Retrieves SSH connection parameters by key, opens SSH session and executes commands remotely via the specified protocol.
When I execute commands `$commands` on $connectionKey over $protocol
-
$commands
- Semicolon-separated commands to execute. -
$connectionKey
- The SSH connection key matching any of configured ones. -
Table 1. The list of the supported$protocol
- The protocol of execution:SSH
orSFTP
.SFTP
commandsCommand Description cd path
Change remote directory to
path
get remote-path
Download file
ls [path]
Display remote directory listing (optionally directory
path
can be specified)mkdir path
Create remote directory
pwd
Display remote working directory
rmdir path
Remove remote directory
rm path
Remove remote file
When I execute commands `cd /; pwd` on my-host over SSH
When I execute commands `cd /Users` on my-host over SFTP
Retrieves SSH connection parameters by key, opens SSH session, executes SFTP commands remotely and saves the result of the commands to the variable.
When I execute commands `$commands` on $connectionKey over SFTP and save result to $scopes variable `$variableName`
-
$commands
- Semicolon-separated SFTP commands to execute.NoteIt’s allowed to combine any SFTP commands, but at least one of them should return result. SFTP commands returning results are:
-
get remote-path
-
ls [path]
-
pwd
-
-
$connectionKey
- The SSH connection key matching any of configured ones. -
$scopes
- The comma-separated set of the variables scopes. -
$variableName
- The name of the variable to save the SFTP commands execution result.
When I execute commands `get remote-file.txt` on my-host over SFTP and save result to scenario variable `file-content`
Retrieves SSH connection parameters by key, opens SSH session and creates file with the given content at the provided remote destination.
When I create file with content `$content` at path `$destination` on $connectionKey over SFTP
-
$content
- The content of the file to create. -
$destination
- The remote file destination. -
$connectionKey
- The SSH connection key matching any of configured ones.
When I create file with content `hello world!` at path `remote-file.txt` on my-host over SFTP
Retrieves SSH connection parameters by key, opens SSH session and copies the local file to the remote destination.
When I copy local file located at `$filePath` to path `$destination` on $connectionKey over SFTP
-
$filePath
- The path of the file to copy. -
$destination
- The remote file destination. -
$connectionKey
- The SSH connection key matching any of configured ones.
When I copy local file located at `local-file.txt` to path `remote-file.txt` on my-host over SFTP