共用方式為


SSH@0 - SSH v0 task

Use this task to run shell commands or a script on a remote machine using SSH. This task enables you to connect to a remote machine using SSH and run commands or a script.

Inputs

sshEndpoint - SSH endpoint
string. Required.

Specifies the name of an SSH service connection containing connection details for the remote machine. The hostname or IP address of the remote machine, the port number, and the user name are required to create an SSH service connection.

  • The private key and the passphrase must be specified for authentication.
  • A password can be used to authenticate to remote Linux machines, but this is not supported for macOS or Windows systems.

runOptions - Run
string. Required. Allowed values: commands, script (Script File), inline (Inline Script). Default value: commands.

Runs shell commands or a shell script on the remote machine.


commands - Commands
string. Required when runOptions = commands.

Specifies the shell commands to run on the remote machine. This parameter is available only when Commands is selected for the Run option. Enter each command together with its arguments on a new line of the multi-line textbox. To run multiple commands together, enter them on the same line separated by semicolons. Example: cd /home/user/myFolder;build.

Note

Each command runs in a separate process. If you want to run a series of commands that are interdependent (for example, changing the current folder before executing a command), use the Inline Script option instead.


scriptPath - Shell script path
string. Required when runOptions = script.

Specifies the path to the shell script file to run on the remote machine. This parameter is available only when Shell script is selected for the Run option.


inline - Inline Script
string. Required when runOptions = inline.

Writes the shell script to run on the remote machine.


args - Arguments
string. Optional. Use when runOptions = script.

Specifies the arguments to pass to the shell script. This parameter is available only when Shell script is selected for the Run option.


failOnStdErr - Fail on STDERR
boolean. Default value: true.

If the value is true, the build fails when the remote commands or script write to STDERR.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Use this task to run shell commands or a script on a remote machine using SSH. This task enables you to connect to a remote machine using SSH and run commands or a script.

Prerequisites

  • The task supports use of an SSH key pair to connect to the remote machine(s).
  • The public key must be pre-installed or copied to the remote machine(s).

Supported algorithms

Key pair algorithms

  • RSA
  • DSA

Encryption algorithms

  • aes256-cbc
  • aes192-cbc
  • aes128-cbc
  • blowfish-cbc
  • 3des-cbc
  • arcfour256
  • arcfour128
  • cast128-cbc
  • arcfour

For OpenSSL v1.0.1 and higher (on agent):

  • aes256-ctr
  • aes192-ctr
  • aes128-ctr

For OpenSSL v1.0.1 and higher, NodeJS v0.11.12 and higher (on agent):

  • aes128-gcm
  • aes128-gcm@openssh.com
  • aes256-gcm
  • aes256-gcm@openssh.com

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.102.0 or greater
Task category Deploy

See also