Hi Community,

I'm unable to pass parameters from Jenkins to remote shell script.

These (3) parameters are;

        ${DATABASE} 
        ${SCHEMA} 
        ${COMMENT}

I have a Jenkins project that uses a slave machine (sys-07) to run shell 
scripts on a remote host (raloda10).

The shell script on the remote host (raloda10), below, works like a charm 
on remote host.


  /u01/app/oracle/databases/dev11g05/bod/jenky_bod_gsa.sh

The shell script is denoted in the Jenkins build ala "* SCRIPT "  *variable.

In the Jenkins project > configure GUI screens we have the parameterized 
build using  Build > Execute Shell (below, between 1-EXECUTE SHELL COMMANDS 
text)

-----------------------------------------

However the console output (below, between 2-CONSOLE OUTPUT text) shows 
that the (3) parameters are not passed to the shell script as the places 
where they should be are blank at the runtime.

The remote host target script (below, between 3-REMOTE SCRIPT CONTENTS text 
) does not get the (3) parameters from Jenkins build.

I've tried a few workarounds but nothing works.

Any advice or help is greatly appreciated. 

Thank you for your time,
Donald



============== 1-EXECUTE SHELL COMMANDS  
==================================================================================

























*#!/bin/bash/opt/admin/bin/print_jenkins_vars.sh export 
ORACLE_USER="oracle" ;export ODA_HOST="raloda10" ;export 
SCRIPT="/u01/app/oracle/databases/dev11g05/bod/jenky_bod_gsa.sh" ;export 
ORACLE_BASE="/u01/app/oracle" ;export 
ORACLE_HOME="/u01/app/oracle/product/11.2.0.4/dbhome_1" ;export 
PATH="$ORACLE_HOME/bin:$PATH:$HOME/bin" ;export 
LD_LIBRARY_PATH="$ORACLE_HOME/lib" ;echo BUILD_TAG                         
= ${BUILD_TAG} ;echo ORACLE_USER                  = ${ORACLE_USER} ;echo 
ODA_HOST                         = ${ODA_HOST} ;echo SCRIPT              
                = ${SCRIPT} ;echo SOURCE_DATABASE         = ${DATABASE} 
;echo SOURCE_SCHEMA           = ${SCHEMA} ;echo COMMENT            
             = ${COMMENT} ;echo# echo "========== Running ${SCRIPT} on 
${ODA_HOST} =========="; echosudo -i -u ${ORACLE_USER} ssh ${ODA_HOST} 
"source /home/oracle/.bash_profile ; ${SCRIPT} ${DATABASE} ${SCHEMA} 
${COMMENT}"# echo# echo "========== Running ${SCRIPT} on ${ODA_HOST} 
=========="; *


============== 1-EXECUTE SHELL COMMANDS  
==================================================================================








============== 2-CONSOLE OUTPUT 
==================================================================================

......



*========== Jenkins vars ==========
BUILD_TAG = jenkins-ERROR-GSA-Ad_Hoc-88
ORACLE_USER = oracle
ODA_HOST = raloda10
SCRIPT = /u01/app/oracle/databases/dev11g05/bod/jenky_bod_gsa.sh
SOURCE_DATABASE = DEV11G05
SOURCE_SCHEMA = ASA14101X5
COMMENT = good state archive

Source database of good state schema: ...
Name of good state schema: ...
Directory location: /export/nfs01/ODA//DMP/ARCHIVE//20170803_1157
Comment: ...

grep: /u01/app/oracle/databases//schema//schema_backup_make_new_sod_source.sh: 
No such file or directory

LRM-00109: could not open parameter file 
'/u01/app/oracle/databases//schema//expdp_.par'
LRM-00113: error when processing file 
'/u01/app/oracle/databases//schema//expdp_.par'

mv: cannot stat `/export/nfs01/ODA//DMP/EXPDP**.DMP': No such file or directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE*


============== 2-CONSOLE OUTPUT 
==================================================================================




============== 3-REMOTE SCRIPT CONTENTS 
==================================================================================

#!/bin/bash
#
export ORACLE_SID=DEV11G05
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
#
#
#
#
declare daystamp
daystamp=$(date +"%Y%m%d_%H%M")
#
# ------- jenky param covert -------
#
sourcedatabase=${DATABASE}
sourceschema=${SCHEMA}
bodcomment=${COMMENT}
#
echo ${DATABASE}
echo ${SCHEMA}
echo ${COMMENT}
#
# ------- jenky param covert -------
#
#
sourcedatabase=`echo $sourcedatabase | tr '[a-z]' '[A-Z]'`
sourcedatabaselw=`echo $sourcedatabase | tr '[A-Z]' '[a-z]'`
sourceschema=`echo $sourceschema | tr '[a-z]' '[A-Z]'`
targetdatabase=`echo $targetdatabase | tr '[a-z]' '[A-Z]'`
targetdatabaselw=`echo $targetdatabase | tr '[A-Z]' '[a-z]'`
targetdatabaseup=`echo $targetdatabase | tr '[a-z]' '[A-Z]'`
targetdbstatus=`echo $targetdbstatus | tr '[a-z]' '[A-Z]'`
targetschemalower=`echo $targetschema | tr '[A-Z]' '[a-z]'`
targetschemalower=`echo $targetschema | tr '[A-Z]' '[a-z]'`
targetschemaupper=`echo $targetschema | tr '[a-z]' '[A-Z]'`
targetschemapassupper=`echo $targetschemapass | tr '[a-z]' '[A-Z]'`
sourceschemalower=`echo $sourceschema | tr '[A-Z]' '[a-z]'`
sourceschemapassup=`echo $sourceschemapass | tr '[a-z]' '[A-Z]'`
sourceschemaupper=`echo $sourceschema | tr '[a-z]' '[A-Z]'`
gsadir=/export/nfs01/ODA/$sourcedatabase/DMP/ARCHIVE/$sourceschemaupper/$daystamp
bodtype=GSA
echo 
echo
echo Source database of good state schema:      $sourcedatabase
echo Name of good state schema:                 $sourceschemaupper
echo Directory location:                        $gsadir
echo Comment:                                   $bodcomment
echo
echo
#
#
#
#
# ------- make GSA directory  --------
#
mkdir -p 
/export/nfs01/ODA/$sourcedatabase/DMP/ARCHIVE/$sourceschemaupper/$daystamp
# ls -l 
/export/nfs01/ODA/$sourcedatabase/DMP/ARCHIVE/$sourceschemaupper/$daystamp
#
# ------- make GSA directory  --------
#
#
#
# ------- get source schema pass -------
#
#
dpline=`grep "expdp" 
/u01/app/oracle/databases/$sourcedatabaselw/schema/$sourceschemalower/schema_backup_make_new_sod_source.sh`
sourceschemapass=`echo ${dpline} | cut -d"@" -f1 | cut -d"/" -f2`
echo $sourceschemapass
#
#
# ------- get ource schema pass -------
#
#
#
# ------- expdp to dmp then move to archive -------
#
expdp $sourceschemaupper/$sourceschemapass@$sourcedatabase 
parfile=/u01/app/oracle/databases/$sourcedatabaselw/schema/$sourceschemalower/expdp_$sourceschemalower.par
mv /export/nfs01/ODA/$sourcedatabase/DMP/EXPDP*${sourceschemaupper}*.DMP 
/export/nfs01/ODA/$sourcedatabase/DMP/ARCHIVE/$sourceschemaupper/$daystamp
#
#
exit

============== 3-REMOTE SCRIPT CONTENTS 
==================================================================================

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/515e6a89-aedd-407d-8c18-68b9d04f9b3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to