SSH Slaves reloaded

Written by: Stephen Connolly
3 min read

Jenkins has a nice built in SSH client that can be used to set up a agent connection… I know because I wrote it.

It's fine for basic usage… but when you start to push the limits of Jenkins, it starts to show some rough edges.

At CloudBees have been working on an improved SSH launcher and we have something that people may find useful.

It's rough and still only beta quality, but as switching back to the existing launcher is easy, if you are a Jenkins Enterprise you may want to give it a try… especially if you have lots of agents.

My initial testing indicates that:

  • Slightly faster at establishing a connection.

  • Saves 3 threads per agent.

  • Saves at least 1 thread per active build.

  • Keep-alive may work better

  • Really good at detecting broken connections

The downsides:

  • There are some SSH servers that it will bomb out faster against… largely because it's really good at detecting broken connections.

  • Does not support all SSH private key schemes (only RSA and DSA due to the backing library we use)

  • Does not fall back to SCP for copying the agent jar file if the SSH Server does not support SFTP

  • Nowhere near as battle tested.

How do you configure it? You need to install the plugin (can be installed without restart but requires a Jenkins Enterprise by CloudBees license to install) and then you just change the launch method to "Launch agent agents on Unix machines via SSH (Non-blocking I/O)"

The configuration options are mostly the same:

The only difference being that by default we do not print out the shell environment (you can turn that on with the "Log environment on initial connect" option) as that is only needed if you are debugging a problematic connection.

If you are reconfiguring an existing SSH agent connection you will need to disconnect and reconnect the agent. You should then see something like this on the agent log:

When things go wrong though, you may find something like:

Problems like the above are what we want to find out about… things like what OS the server is running, what the target version of Java is, what the SSH Sever is (in this case it's a dodgy version of OpenSSH… one that works fine for the standard SSH agents connector, but sadly, not for this one)

If you want to try this plugin, and you have a Jenkins Enterprise license, you can download the plugin from:

—Stephen Connolly

Stephen Connolly has over 20 years experience in software development. He is involved in a number of open source projects, including Jenkins . Stephen was one of the first non-Sun committers to the Jenkins project and developed the weather icons. Stephen lives in Dublin, Ireland - where the weather icons are particularly useful. Follow Stephen on Twitter and on his blog .

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.