If ssh-add does not have a terminal associated with it but DISPLAY and SSHASKPASS are set, it will execute the program specified by SSHASKPASS (by default ``ssh-askpass' and open an X11 window to read the passphrase. This is particularly useful when calling ssh-add from a.xsession or related script. (Note that on some machines it may be. Galbraith and P. Remaker, The Secure Shell (SSH) Session Channel Break Extension, RFC 4335, January 2006. Namprempre, The Secure Shell (SSH) Transport Layer Encryption Modes, RFC 4344, January 2006. Harris, Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol, RFC 4345, January 2006.
The following plugin provides functionality available throughPipeline-compatible steps. Read more about how to integrate steps into yourPipeline in theStepssection of thePipeline Syntaxpage.
For a list of other such plugins, see thePipeline Steps Referencepage.
- Publish Over SSH
Publish Over SSH
step([$class: 'BapSshPromotionPublisherPlugin'])
: Send build artifacts over SSH
publishers
- Array / List of Nested Object
configName
Select an SSH configuration from the list configured in the global configuration of this Jenkins.
The configuration defines the connection properties and base directory of the SSH server.
- Type:
String
- Type:
verbose
Select to enable an obscene amount of information to the Jenkins console - only really useful to help track down problems.- Type:
boolean
- Type:
transfers
- Array / List of Nested Object
sourceFiles
Files to upload to a server.
The string is a comma separated list of includes for an Ant fileset eg. '**/*.jar' (see Patterns in the Ant manual).
The base directory for this fileset is the workspace.- Type:
String
- Type:
excludes
Exclude files from the Transfer set.
The string is a comma separated list of excludes for an Ant fileset eg. '**/*.log,**/*.tmp,.git/' (see Patterns in the Ant manual)
- Type:
String
- Type:
remoteDirectory
Optional destination folder. Java™ SE Development Kit 8, Update 291 Release Notes.
This folder will be below the one in the global configuration, if present.
The folder will be created if does not exist.- Type:
String
- Type:
removePrefix
First part of the file path that should not be created on the remote server.
Directory structures are created relative to the base directory, which is usually the workspace.
You normally do not want the full path to these files to be created on the server.
For example if Source files weretarget/deployment/images/**/
then you may want Remove prefix to betarget/deployment
This would create the images folder under the remote directory, and not target/deployment
Jenkins environment variables can be used in this path.If you use remove prefix, then ALL source file paths MUST start with the prefix.
- Type:
String
- Type:
remoteDirectorySDF
Select this to include the timestamp in the remote directory.
The timestamp is the date of build. If this publisher is being used during a promotion, then the timestamp is that of the build that is being promoted.
This setting turns the remote directory option into a java SimpleDateFormat.
The SimpleDateFormat(SDF) uses letters to represent components of the date, like the month, year, or day of the week. Click here for more information about the date patterns.
As the SDF reserves all of the letters [A-Z][a-z], any that you want to appear literally in the directory that is created will need to be quoted.Some examples follow - all examples are based on a build with a timestamp of 3:45 pm and 55 seconds on the 7th November 2010.
Remote directory Directories created 'qa-approved/'yyyyMMddHHmmss
qa-approved/20101107154555
'builds/'yyyy/MM/dd/'build-${BUILD_NUMBER}'
builds/2010/11/07/build-456
(if the build was number 456)yyyy_MM/'build'-EEE-d-HHmmss
2010_11/build-Sun-7-154555
yyyy-MM-dd_HH-mm-ss
2010-11-07_15-45-55
- Type:
boolean
- Type:
flatten
Only create files on the server, don't create directories (except for the remote directory, if present).
All files that have been selected to transfer must have unique filenames. The publisher will stop and fail as soon as a duplicate filename is found when using the flatten option.
- Type:
boolean
- Type:
cleanRemote
- Type:
boolean
- Type:
noDefaultExcludes
- Type:
boolean
- Type:
makeEmptyDirs
The default behaviour of this plugin is to match files, and then create any directories required to preserve the paths to the files.
Selecting this option will create any directories that match the Source files pattern, even if empty.- Type:
boolean
- Type:
patternSeparator
The regular expression that is used to separate the Source files and Exclude files patterns.
The Source files and Exclude files both accept multiple patterns that by default are split using
which is how Ant, by default, handles multiple patterns in a single string.The above expression makes it difficult to reference files or directories that contain spaces. This option allows the expression to be set to something that will preserve the spaces in a pattern eg. a single comma.
- Type:
String
- Type:
execCommand
(optional)A command to execute on the remote server.
This command will be executed on the remote server after any files are transferred.
The SSH Transfer Set must include either a Source Files pattern, an Exec command, or both. If both are present, the files are transferred before the command is executed. If you want to Exec before the files are transferred, use 2 Transfer Sets and move the Exec command before the Transfer set that includes a Source files pattern.- Type:
String
- Type:
execTimeout
(optional)- Type:
int
- Type:
usePty
(optional)Exec the command in a pseudo tty.
This will enable the execution of sudo commands that require a tty (and possibly help in other scenarios too.)
From the sudoers(5) man page:- Type:
boolean
- Type:
useAgentForwarding
(optional)Exec the command using Agent Forwarding.
Allows a chain of ssh connections to forward key challenges back to the original agent, thus eliminating the need for using a password or public/private keys for these connections.
From the ssh(1) man page:
- Type:
boolean
- Type:
useSftpForExec
(optional)Using SFTP protocol instead of SSH for Exec command.
Supported commands: mkdir, ln, symlink, rm, rmdir, cd, get, ls
- Type:
boolean
- Type:
useWorkspaceInPromotion
Set the root directory for the Source files to the workspace.
By default this plugin uses the artifacts directory (where archived artifacts are stored). This allows the artifacts from the build number that you are promoting to be sent somewhere else.
If you run tasks that produce files in the workspace during the promotion and you want to publish them, then set this option.
If you need to send files from both the workspace and the archive directory, then you need to add a second server, even if you want to send the files to the same place. This is due to the fact that the workspace is not necessarily on the same host as the archive directory.
- Type:
boolean
- Type:
usePromotionTimestamp
Use the build time of the promotion when the remote directory is a date format.
By default this plugin uses the time of the original build (the one that is being promoted) when formatting the remote directory. Setting this option will mean that if you use the remote directory is a date format option, it will use the time that the promotion process runs, instead of the original build.
- Type:
boolean
- Type:
sshRetry
If publishing to this server or command execution fails, try again.
Files that were successfully transferred will not be re-sent.
If Exec command is configured, but fails in any way (including a non zero exit code), then it will be retried.- Nested Object
retries
The number of times to retry this server in the event of failure.- Type:
int
- Type:
retryDelay
The time to wait, in milliseconds, before attempting another transfer.- Type:
long
- Type:
sshLabel
Set the label for this Server instance - for use with Parameterized publishing.
Expand the help for Parameterized publishing for more details.
- Nested Object
label
Set the label for this Server instance - for use with Parameterized publishing.
Expand the help for Parameterized publishing for more details.
- Type:
String
- Type:
sshCredentials
Set the credentials to use with this connection.If you want to use different credentials from those configured for this server, or if the credentials have not been specified for this server, then enable this option and set them here.
- Nested Object
username
- Type:
String
- Type:
encryptedPassphrase
The passphrase for the private key, or the password for password authentication if noKey
orPath to key
is configured.
Leave blank if the key is not encrypted.- Type:
String
- Type:
key
The private key.
Paste the private key here, or provide the path to the file containing the key in
Path to key
.- Type:
String
- Type:
keyPath
The path to the private key.
Either supply the path to the file containing the key, or paste the key into the
Key
box.
ThePath to key
can be absolute, or relative to$JENKINS_HOME
- Type:
String
- Type:
continueOnError
- Type:
boolean
- Type:
failOnError
- Type:
boolean
- Type:
alwaysPublishFromMaster
- Type:
boolean
- Type:
masterNodeName
- Type:
String
- Type:
paramPublish
- Nested Object
parameterName
The name of the parameter or environment variable that will contain the expression for matching the labels.- Type:
String
- Type:
sshPublisher
: Send build artifacts over SSH
alwaysPublishFromMaster
(optional)Select to publish from the Jenkins master.
The default is to publish from the server that holds the files to transfer (workspace on the agent, or artifacts directory on the master).
Enabling this option could help dealing with strict network configurations and firewall rules.
This option will cause the files to be transferred through the master before being sent to the remote server, this may increase network traffic, and could increase the build time.- Type:
boolean
- Type:
continueOnError
(optional)Select to continue publishing to the other servers after a problem with a previous server.- Type:
boolean
- Type:
failOnError
(optional)Select to mark the build as a failure if there is a problem publishing to a server. The default is to mark the build as unstable.- Type:
boolean
- Type:
masterNodeName
(optional)Set the NODE_NAME for the master Jenkins.
Set this option to give a value to the NODE_NAME environment variable when the value is missing (the Jenkins master).
This is useful if you use the NODE_NAME variable in the remote directory option and the build may occur on the master.- Type:
String
- Type:
paramPublish
(optional)- Nested Object
parameterName
The name of the parameter or environment variable that will contain the expression for matching the labels.- Type:
String
- Type:
publishers
(optional)- Array / List of Nested Object
configName
Select an SSH configuration from the list configured in the global configuration of this Jenkins.
The configuration defines the connection properties and base directory of the SSH server.
- Type:
String
- Type:
verbose
Select to enable an obscene amount of information to the Jenkins console - only really useful to help track down problems.- Type:
boolean
- Type:
transfers
- Array / List of Nested Object
sourceFiles
Files to upload to a server.
The string is a comma separated list of includes for an Ant fileset eg. '**/*.jar' (see Patterns in the Ant manual).
The base directory for this fileset is the workspace.- Type:
String
- Type:
excludes
Exclude files from the Transfer set.
The string is a comma separated list of excludes for an Ant fileset eg. '**/*.log,**/*.tmp,.git/' (see Patterns in the Ant manual)
- Type:
String
- Type:
remoteDirectory
Optional destination folder.
This folder will be below the one in the global configuration, if present.
The folder will be created if does not exist.- Type:
String
- Type:
removePrefix
First part of the file path that should not be created on the remote server.
Directory structures are created relative to the base directory, which is usually the workspace.
You normally do not want the full path to these files to be created on the server.
For example if Source files weretarget/deployment/images/**/
then you may want Remove prefix to betarget/deployment
This would create the images folder under the remote directory, and not target/deployment
Jenkins environment variables can be used in this path.If you use remove prefix, then ALL source file paths MUST start with the prefix.
- Type:
String
- Type:
remoteDirectorySDF
Select this to include the timestamp in the remote directory.
The timestamp is the date of build. If this publisher is being used during a promotion, then the timestamp is that of the build that is being promoted.
This setting turns the remote directory option into a java SimpleDateFormat.
The SimpleDateFormat(SDF) uses letters to represent components of the date, like the month, year, or day of the week. Click here for more information about the date patterns.
As the SDF reserves all of the letters [A-Z][a-z], any that you want to appear literally in the directory that is created will need to be quoted.Some examples follow - all examples are based on a build with a timestamp of 3:45 pm and 55 seconds on the 7th November 2010.
Remote directory Directories created 'qa-approved/'yyyyMMddHHmmss
qa-approved/20101107154555
'builds/'yyyy/MM/dd/'build-${BUILD_NUMBER}'
builds/2010/11/07/build-456
(if the build was number 456)yyyy_MM/'build'-EEE-d-HHmmss
2010_11/build-Sun-7-154555
yyyy-MM-dd_HH-mm-ss
2010-11-07_15-45-55
- Type:
boolean
- Type:
flatten
Only create files on the server, don't create directories (except for the remote directory, if present).
All files that have been selected to transfer must have unique filenames. The publisher will stop and fail as soon as a duplicate filename is found when using the flatten option.
- Type:
boolean
- Type:
cleanRemote
- Type:
boolean
- Type:
noDefaultExcludes
- Type:
boolean
- Type:
makeEmptyDirs
The default behaviour of this plugin is to match files, and then create any directories required to preserve the paths to the files.
Selecting this option will create any directories that match the Source files pattern, even if empty.- Type:
boolean
- Type:
patternSeparator
The regular expression that is used to separate the Source files and Exclude files patterns.
The Source files and Exclude files both accept multiple patterns that by default are split using
which is how Ant, by default, handles multiple patterns in a single string.The above expression makes it difficult to reference files or directories that contain spaces. This option allows the expression to be set to something that will preserve the spaces in a pattern eg. a single comma.
- Type:
String
- Type:
execCommand
(optional)A command to execute on the remote server.
This command will be executed on the remote server after any files are transferred.
The SSH Transfer Set must include either a Source Files pattern, an Exec command, or both. If both are present, the files are transferred before the command is executed. If you want to Exec before the files are transferred, use 2 Transfer Sets and move the Exec command before the Transfer set that includes a Source files pattern.- Type:
String
- Type:
execTimeout
(optional)Timeout in milliseconds for the Exec command.
Set to zero to disable.
- Type:
int
- Type:
usePty
(optional)Exec the command in a pseudo tty.
This will enable the execution of sudo commands that require a tty (and possibly help in other scenarios too.)
From the sudoers(5) man page:- Type:
boolean
- Type:
useAgentForwarding
(optional)Exec the command using Agent Forwarding.
Allows a chain of ssh connections to forward key challenges back to the original agent, thus eliminating the need for using a password or public/private keys for these connections.
From the ssh(1) man page:
- Type:
boolean
- Type:
useSftpForExec
(optional)Using SFTP protocol instead of SSH for Exec command.
Supported commands: mkdir, ln, symlink, rm, rmdir, cd, get, ls
- Type:
boolean
- Type:
useWorkspaceInPromotion
Set the root directory for the Source files to the workspace.
By default this plugin uses the artifacts directory (where archived artifacts are stored). This allows the artifacts from the build number that you are promoting to be sent somewhere else.
If you run tasks that produce files in the workspace during the promotion and you want to publish them, then set this option.
If you need to send files from both the workspace and the archive directory, then you need to add a second server, even if you want to send the files to the same place. This is due to the fact that the workspace is not necessarily on the same host as the archive directory.
- Type:
boolean
- Type:
usePromotionTimestamp
Use the build time of the promotion when the remote directory is a date format.
By default this plugin uses the time of the original build (the one that is being promoted) when formatting the remote directory. Setting this option will mean that if you use the remote directory is a date format option, it will use the time that the promotion process runs, instead of the original build.
- Type:
boolean
- Type:
sshRetry
If publishing to this server or command execution fails, try again.
Files that were successfully transferred will not be re-sent.
If Exec command is configured, but fails in any way (including a non zero exit code), then it will be retried.- Nested Object
retries
The number of times to retry this server in the event of failure.- Type:
int
- Type:
retryDelay
The time to wait, in milliseconds, before attempting another transfer.- Type:
long
- Type:
sshLabel
Set the label for this Server instance - for use with Parameterized publishing.
Expand the help for Parameterized publishing for more details.
- Nested Object
label
Set the label for this Server instance - for use with Parameterized publishing.
Expand the help for Parameterized publishing for more details.
- Type:
String
- Type:
sshCredentials
Set the credentials to use with this connection.If you want to use different credentials from those configured for this server, or if the credentials have not been specified for this server, then enable this option and set them here.
- Nested Object
username
- Type:
String
- Type:
encryptedPassphrase
The passphrase for the private key, or the password for password authentication if noKey
orPath to key
is configured.
Leave blank if the key is not encrypted.- Type:
String
- Type:
key
The private key.
Paste the private key here, or provide the path to the file containing the key in
Path to key
.- Type:
String
- Type:
keyPath
The path to the private key.
Either supply the path to the file containing the key, or paste the key into the
Key
box.
ThePath to key
can be absolute, or relative to$JENKINS_HOME
- Type:
String
- Type:
Please submit your feedback about this page through thisquick form.
Alternatively, if you don't wish to complete the quick form, you can simplyindicate if you found this page helpful?
Ssh Man Page
See existing feedback here.