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
Types
Functions
Deletes all configured build step conditions
Configures build step conditions
Copies parameters of this object to the specified target
Creates an instance of this build step via reflection using a no argument constructor, used during copying. Throws an error if this class doesn't have a default constructor. Subclasses can override it to create an instance without using a default constructor.
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