title: JENKINS pass parameters as inputs to remote host script
body: <p>We have a (3) tier system for Jenkins projects and builds.
  We have setup a trust relationship between worker node and remote host
  via SSH plugin and keys.</p>
  
  <pre><code>jenkinsrh-01 = main jenkins server (gui for projects/builds, dashboard, etc)
  sys-07       = worker  node  (projects / builds are run from this remote node)
  raloda10     = remote host  (target of builds)
  </code></pre>
  
  <p>In the gui configuration screen at main Jenkins server (jenkinsrh-01), we have this code below for our project with hardcoded parameter values et al.
  The $SCRIPT is located at remote host and we want to pass the parameter values for use by remote host script.</p>
  
  <p>Build --> Execute Shell --> Command</p>
  
  <pre><code>#!/bin/bash
  
  export ORACLE_USER="oracle"
  export ODA_HOST="raloda10"
  export DATABASE="DEV11G05"
  export SCHEMA="ASA14101X5"
  export COMMENT="good state archive"
  export SCRIPT="/u01/app/oracle/databases/dev11g05/bod/jenky_test.sh"
  
  sudo -i -u ${ORACLE_USER} ssh ${ODA_HOST} ${SCRIPT} 
  </code></pre>
  
  <p>On the target remote host (raloda10) the contents of the target script
  is a simple test to echo the values of the parameters passed to it via "export" verbiage in the build steps above. The target remote host script (jenky_test.sh) contents are;</p>
  
  <pre><code>#!/bin/bash
  #
  #
  echo
  echo This is correct target script on remote host
  echo 
  echo 1. Source database: ${DATABASE}
  echo 2. Name of  schema: ${SCHEMA}
  echo 3. Comments: ${COMMENT}
  echo
  echo ${DATABASE}
  echo ${SCHEMA}
  echo ${COMMENT}
  #
  exit
  </code></pre>
  
  <p>The worker build can access the remote host, find the remote host script, and run the shell script, "jenky_test.sh".  </p>
  
  <p>But the issue is that none of the build parameters are passed into the jenky_test.sh script when it runs. It does not echo back the values as they are blank as evidenced in the "Console Output", below;</p>
  
  <pre><code>Started by user Donald Collins
  [EnvInject] - Loading node environment variables.
  Building remotely on sys-07 (SYS-07) in workspace /var/lib/jenkins/workspace/fails_Send_Jenkins_Parameters_fromSlave_as_Inputs_for_Script_on_Remote_Host
  [fails_Send_Jenkins_Parameters_fromSlave_as_Inputs_for_Script_on_Remote_Host] $ /bin/bash /tmp/hudson7103389345936604753.sh
  
  This is correct target script on remote host
  
  1. Source database:
  2. Name of schema:
  3. Comments:
  </code></pre>
  
  <p>The console output should be showing the values of the exported variables (parameters) for lines 1,2, and 3 above.  Instead they are blank.</p>
  
  <p>I've tried all sorts of various combinations of different coding for the "sudo" call in the Command step of Execute Shell. "Nothing" seems to be able to get the parameter values to be passed as inputs for jenky_test.sh on remote target host.</p>
  
  <p>I'm sure I'm missing something here that is obvious as what I'm trying to do with Jenkins is "Jenkins 101" stuff ;) ...</p>
  
  <p>Any help or advice is greatly appreciated.</p>
  
  <p>Best Regards,
  Donald</p>