SSHUpload
An SSH Upload build step.
Example. Adds an SSH Upload build step with SCP transport protocol and custom timeout. Uploaded key authentication method is used.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
sshUpload {
name = "My SSH Upload build step"
transportProtocol = SSHUpload.TransportProtocol.SCP
sourcePath = """
dir/**/*.zip
*.zip => winFiles
unix/distro.tgz => linuxFiles
""".trimIndent()
targetUrl = "hostname:path/to/target/folder"
timeout = 30
authMethod = uploadedKey {
username = "username"
passphrase = "credentialsJSON:******"
key = "id_rsa"
}
}
Content copied to clipboard }
}
Example. Adds an SSH Upload build step with SFTP transport protocol, custom port and disabled timeout. Default private key authentication method is used.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
sshUpload {
name = "My SSH Upload build step"
transportProtocol = SSHUpload.TransportProtocol.SFTP
sourcePath = """
dir/**/*.zip
*.zip => winFiles
unix/distro.tgz => linuxFiles
""".trimIndent()
targetUrl = "hostname:path/to/target/folder"
port = 2222
timeout = 0
authMethod = defaultPrivateKey {
username = "username"
passphrase = "credentialsJSON:******"
}
}
Content copied to clipboard }
}
Example. Adds an SSH Upload build step with SFTP transport protocol. Custom private key authentication method is used.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
sshUpload {
name = "My SSH Upload build step"
transportProtocol = SSHUpload.TransportProtocol.SFTP
sourcePath = """
dir/**/*.zip
*.zip => winFiles
unix/distro.tgz => linuxFiles
""".trimIndent()
targetUrl = "hostname:path/to/target/folder"
authMethod = customPrivateKey {
keyFile = "path/to/key/file"
username = "username"
passphrase = "credentialsJSON:******"
}
}
Content copied to clipboard }
}
Example. Adds an SSH Upload build step with SCP transport protocol. Password authentication method is used.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
sshUpload {
name = "My SSH Upload build step"
transportProtocol = SSHUpload.TransportProtocol.SCP
sourcePath = """
dir/**/*.zip
*.zip => winFiles
unix/distro.tgz => linuxFiles
""".trimIndent()
targetUrl = "hostname:path/to/target/folder"
authMethod = password {
username = "username"
password = "credentialsJSON:******"
}
}
Content copied to clipboard }
}
Example. Adds an SSH Upload build step with SCP transport protocol. SSH-Agent authentication method is used. This build step will run even if some previous build steps are failed and additional condition is met.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
sshUpload {
name = "My SSH Upload build step"
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
conditions {
equals("teamcity.build.branch", "release")
}
transportProtocol = SSHUpload.TransportProtocol.SCP
sourcePath = """
dir/**/*.zip
*.zip => winFiles
unix/distro.tgz => linuxFiles
""".trimIndent()
targetUrl = "hostname:path/to/target/folder"
authMethod = sshAgent {
username = "username"
}
}
Content copied to clipboard }
}
See also
Constructors
Properties
An SSH authentication method.
Optional collection of build step execution conditions
Build step execution mode
Newline- or comma-separated paths to files/directories to be deployed. Ant-style wildcards like dir/**/*.zip and target directories like *.zip => winFiles,unix/distro.tgz => linuxFiles, where winFiles and linuxFiles are target directories, are supported.
An SSH transfer protocol to use.
Functions
Deletes all configured build step conditions
Configures build step conditions
Copies parameters of this object to the specified target
Will try to perform private key authentication using the given public key file with given passphrase.
Will try to perform private key authentication using the ~/.ssh/config settings. If no settings file exists, will try to use the ~/.ssh/rsa_pub public key file.
Simple password authentication.
Use ssh-agent for authentication, the SSH-Agent build feature must be enabled.
Uses the key(s) uploaded to the project.
Validates this object and reports found errors to the provided consumer