Anton Kim
Anton Kim

Reputation: 943

Jenkins - execute script on different machine with local env variables

Have:

  1. Jenkins job that needs to execute bash command and initialise variable locally:

    GOOD_VARIABLE=command

  2. SSH into remote host and execute another command with above variable

    command ${GOOD_VARIABLE}...

Problem:

I know how to ssh into another machine and execute command there but how can I pass that local variable to remote host?

Tried but didn't work:

Upvotes: 4

Views: 1769

Answers (1)

Luc
Luc

Reputation: 1433

sounds like your problem is how to send a var through SSH.

You have a detailed answer there: https://unix.stackexchange.com/questions/299037/pass-variable-in-ssh

Don't forget the -T when using SSH through Jenkins!

Upvotes: -1

Related Questions