Reputation: 633
I am trying to execute shell script on remote host but I am not sure how to pass Jenkins Environment Variable for Ex: BUILD_NUMBER
Execute shell script on remote host using ssh SSH site
Could some one let me know how to do it? Thanks praveen
Upvotes: 2
Views: 11106
Reputation: 123
Just in case somebody is still puzzling over this issue, as the SSH Exec command still behaves in the same undocumented way, you need to quote the parameters you wish to pass to the command, for example :
/path/to/script "$BUILD_NUMBER" "$GIT_BRANCH"
Upvotes: 1
Reputation: 1
Using SSH plugin to execute ssh on remote host, do below :
export BUILD_NUMBER
/path/to/myshellscript
Upvotes: 0
Reputation: 21140
Just pass $BUILD_NUMBER as a parameter to your remote shell script when you fill out the Command field in your build step. For example:
Remote shell script contents:
echo "Build number is $1"
Command field contents:
"/path/to/myshellscript $BUILD_NUMBER"
Upvotes: 1