Kevin
Kevin

Reputation: 75

Configuring Jenkins SSH options to slave nodes

I am running Jenkins on Ubuntu 14.04 (Trusty Tahr) with slave nodes via SSH. We're able to communicate with the nodes to run most commands, but when a command requires a tty input, we get the classic

the input device is not a TTY

error. In our case, it's a docker exec -it command.

So I'm searching through loads of information about Jenkins, trying to figure out how to configure the connection to the slave node to enable the -t option to force tty instances, and I'm coming up empty. How do we make this happen?

Upvotes: 3

Views: 2108

Answers (1)

bishop
bishop

Reputation: 39474

As far as I know, you cannot give -t to the ssh that Jenkins fires up (which makes sense, as Jenkins is inherently detached). From the documentation:

When the SSH slaves plugin connects to a slave, it does not run an interactive shell. Instead it does the equivalent of your running "ssh slavehost command..." a few times...

However, you can defeat this in your build scripts by...

  • looping back to yourself: ssh -t localhost command
  • using a local PTY generator: script --return -c "command" /dev/null

Upvotes: 1

Related Questions