0

From a jenkins file I am calling a shell script and passing three environment variables. Below is my shell script

workspace=${2}
build_no=${1}
branch_name=${3}

echo Generatig Javadoc files
"${JDK_HOME}/bin/javadoc" -classpath ${PLANNING_HOME}/lib/Jersey/jersey-core.jar -sourcepath "${PLANNING_HOME}/src" -windowtitle "Oracle Enterprise Performance Management Cloud, Groovy Rules" -header "Oracle Enterprise Performance Management Cloud, Groovy Rules Java API Reference" -bottom "Copyright © 2017, 2020, Oracle and/or its affiliates. All rights reserved." -overview ${workspace}/planning/build/groovy-overview.html -public -nodeprecated -d "/net/slcnas502.us.oracle.com/export/EPM_Planning/PlanningDev/Buzz/tmp_pre_rel/Planning/builds/${branch_name}/${build_no}/javadocgroovy" @${workspace}/planning/build/jdocgroovyfiles_ux.dat

I am consuming jdocgroovyfiles_ux.dat file in shell script. And I want to use env variable workspace in the .dat file but its not working.

${workspace}/planning/HspJS/src/oracle/epm/api/GroovyDynamicLocalizedException.java
${workspace}/planning/HspJS/src/oracle/epm/api/GroovyMessageBundle.java

How to make use of worspace variable in jdocgroovyfiles_ux.dat

Ian Abbott
  • 12,773
  • 14
  • 28
Paul
  • 157
  • 2
  • 11
  • It seems you forgot to `export` the variables you set. This is why these variables are not accessible from the subdprocess. [That question](https://stackoverflow.com/questions/1158091/defining-a-variable-with-or-without-export) explains meaning of `export`. – Tsyvarev Aug 24 '20 at 11:50

1 Answers1

0

Instead of :

@${workspace}/planning/build/jdocgroovyfiles_ux.dat

try :

@<(workspace="$workspace" envsubst < "${workspace}/planning/build/jdocgroovyfiles_ux.dat")

Assuming you are using bash.

To troubke shoot command line issue, run following command :

workspace=/scratch/pqsharma/jenkins/workspace/Planning_develop
cat <(workspace="$workspace" envsubst < "${workspace}/planning/build/jdocgroovyfiles_ux.dat")
Philippe
  • 14,211
  • 2
  • 16
  • 22