TeamCity Cloud 2024.03 Help

SSH Upload

The SSH Upload build runner allows uploading files/directories via SSH (using SCP or SFTP protocols).

The settings common for all runners are described in Configuring Build Steps; this page details the SSH Deployer settings.

The fields below support parameter references: any text between percentage signs (%) is considered a reference to a property by TeamCity. To prevent TeamCity from treating the text in the percentage signs as reference to a property, use two percentage signs to escape them: for example, if you want to pass %Y%m%d%H%M%S into the build, change it to %%Y%%m%%d%%H%%M%%S.

Option

Description

Step name

Optional Name of the build step displayed in the TeamCity UI.

Step ID

ID for this build step, which must be unique across all steps of this configuration. Used in URLs, REST API, DSL, HTTP requests to the server, and configuration settings in the TeamCity Data Directory.

Execute step

Enables you to modify the default build condition, and optionally add more build conditions.

Deployment Target

Target

SSH server location where the files will be uploaded, specified in the format:

{hostname|IP_address}[:targer_dir[/sub_path]]

where target_dir can be absolute or relative and sub_path can have any depth.

Transport protocol

Select a protocol to transfer data over SSH. The available options are: SCP and SFTP

Port

Optional Port. Defaults to port 22.

Timeout

Optional Timeout for the connection in seconds. Defaults to 0.

Deployment Credentials

Authentication method

Select an authentication method:

  • Uploaded key — uses the key(s) uploaded to the project. See SSH Keys Management for details.

  • Default private key — performs private key authentication using the ~/.ssh/config settings or, if no settings file exists, using the ~/.ssh/id_rsa private key file.

  • Custom private key — performs private key authentication using the specified private key file and passphrase.

  • Password — uses simple password authentication.

  • SSH-Agent — uses SSH agent for authentication, where the SSH-Agent build feature must be enabled.

Deployment Source

Paths to sources

Specify the deployment sources as a newline- or comma-separated list of paths to files/directories.

The field supports Ant-style wildcard patterns (for example, dir/**/*.zip).
You can also specify a target directory to be created using the file => directory pattern (for example, *.zip => winFiles,unix/distro.tgz => linuxFiles will create the winFiles and linuxFiles directories, and respectively put the declared files inside them).

Example

For example, consider the case where you need to add an SSH Upload build step to upload Java packages to an SSH server (on the ssh.example.com host). Suppose you use the jdoe account on the SSH server with the home directory /jdoe, and the SSH server is configured to use SSH keys for authentication.

  1. Follow the steps in Generated SSH Keys to generate a new SSH key pair in your project. Call the key pair PackageUploadKey.

  2. Copy the public key from the PackageUploadKey key pair.

  3. Log in to the jdoe account on your SSH server and follow the instructions from your SSH server provider to add the PackageUploadKey public key to this account.

  4. In your project's build configuration, go to the Build Steps page and click Add build step.

  5. On the New Build Step page, select the SSH Upload runner.

  6. On the New Build Step: SSH Upload page, fill in the fields, as follows:

    • Step name — Enter UploadJavaPackages

    • Target — Enter ssh.example.com:/jdoe

    • Authentication method — Select Uploaded key

    • Username — Enter jdoe (the username for the account on the SSH server)

    • Select key — Select PackageUploadKey from the dropdown list

    • Paths to sources — Enter the following paths:

      ch-simple/simple/target/*.jar => packages

  7. Click Save to create the build step.

Last modified: 14 December 2023