Skip to main content
← Back to workflows

How to Publish Over SSH in Jenkins?

publish-over-ssh -
Jenkins Plugin
v.1.25
113
Required Jenkins: v.2.361.4
ID: publish-over-ssh
Contributors
Contributor - bap2000Contributor - gmcdonaldContributor - slide
Categories
CICUBE ANALYTICS INSIGHTS
Engineering Velocity: 25% Team Time Lost to CI Issues
View Platform →
3.5h
Time Saved/Dev/Week
40%
Faster Releases
Click for next insight
Installation with the CLI tool
jenkins-plugin-cli --plugins publish-over-ssh:1.25

publish-over-ssh-plugin logo

publish-over-ssh-plugin

Publish Over SSH Plugin enables file transfer and remote command execution in Jenkins


What is Publish Over SSH Plugin?

We are diving into the "Publish Over SSH Plugin for Jenkins," which is part of a suite that includes Publish over CIFS and Publish over FTP. These plugins share a lot of common configuration options, enhancing our deployment processes.

Firstly, if you're not familiar, it’s worth checking out the documentation on "Publish Over" as it covers the general settings that apply to all these plugins. Understanding these will give you a good foundation.

Here's a focus on what’s specific to the Publish Over SSH:

  • SSH-Specific Settings: The documentation for Publish Over SSH will detail options that are unique to SSH, like SSH key management, specific security settings, and possibly performance optimizations related to SSH protocols.

Using this plugin effectively allows us to securely transfer build artifacts to remote servers over SSH, which is critical for our deployment pipelines. It’s reliable and integrates well with Jenkins, automating our processes more smoothly.

What Features Does the Publish Over SSH Plugin Offer in Jenkins?

  • Secure Copy Protocol (SCP): Send files securely over SSH (SFTP) to remote servers.
  • Execute Commands Remotely: Run commands on a remote server; this can be disabled for specific server configurations or entirely for the plugin.
  • Authentication: Supports both username/password (keyboard-interactive) and public key authentication methods. All passwords and passphrases are encrypted in configuration files and the UI.
  • Integration as Build Step: The SSH SFTP and SSH Exec features can be used as build steps in both Freestyle and Matrix projects.
  • Build Wrappers: Introduces two new options in the Build Environment section of the job configuration to send files or execute commands over SSH either before the build starts or after it runs.
    • Pre-build: Useful particularly for Maven projects, allowing SSH operations post-workspace setup but pre-build start.
    • Post-build: Executes commands or sends files after the build completes, irrespective of the build's success, useful for cleanup or service shutdown tasks.
  • Promotion Awareness: The plugin can send files directly from the artifacts directory of the build being promoted, which is handy for progressive deployments.
  • Flexible Authentication: Override authentication credentials for each server in the job configuration or provide them if not already configured globally.
  • Reliability Features: Options to retry file transfers on failure and execute commands/scripts in a pseudo TTY, improving reliability over unstable connections.

These features make the "Publish Over SSH Plugin" a powerful tool for automating and securing file transfers and remote operations throughout our build and deployment processes. Let's consider integrating these into our workflow to streamline our operations and enhance security.