0

I am trying to run a shell script through jenkins pipeline. When I run it manually it works fine. But in same machine when I am execute it through jenkins file it is failing.

Jenkins file :-

if ("${BRANCH_NAME}".startsWith("users"))
        {
        node ('linux')
        {
            stage('run groovy script')
            {
            stdout = sh(script: '"$MyWorkSpaceLinux/planning/build/jdocgroovy.sh" ${BUILD_NUMBER}', returnStdout : true)
            println("running groovy stdout################ " + stdout + " ####################")
            }
        }
        }

Below is the error:

javadoc: error - cannot read jdocgroovyfiles_ux.dat (No such file or directory)
cp: cannot stat `groovy-examples.html': No such file or directory
Emptying out Javadoc folder
Generatig Javadoc files

Below is the shell script:-

export PLANNING_HOME=/scratch/pqsharma/jenkins/workspace/Planning_develop/planning/HspJS
export JDK_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64/

build_no=${1}
echo Emptying out Javadoc folder
mkdir "/net/slcnas502.us.oracle.com/export/EPM_Planning/PlanningDev/Buzz/tmp_pre_rel/Planning/builds/develop/${build_no}/src/javadocgroovy"


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 groovy-overview.html -public -nodeprecated -d "/net/slcnas502.us.oracle.com/export/EPM_Planning/PlanningDev/Buzz/tmp_pre_rel/Planning/builds/develop/${build_no}/src/javadocgroovy" @jdocgroovyfiles_ux.dat

cp groovy-examples.html "/net/slcnas502.us.oracle.com/export/EPM_Planning/PlanningDev/Buzz/tmp_pre_rel/Planning/builds/develop/${build_no}/src/javadocgroovy"

Someone kindly help me to understand why am I not able to execute it through jenkins file

6
  • Looks like you need the full path to groovy-examples.html in your cp command. Commented Jul 7, 2020 at 17:24
  • I think his is the main error "javadoc: error - cannot read jdocgroovyfiles_ux.dat (No such file or directory) " Commented Jul 7, 2020 at 17:30
  • Yeah. Same issue with that file as well. Full path required. Commented Jul 7, 2020 at 17:51
  • but when I run the same script manually I didn't face the issue. @jdocgroovyfiles_ux.dat, here where to add the path. file name is jdocgroovyfiles_ux.dat Commented Jul 7, 2020 at 17:56
  • Did you run the script manually from the same directory as the files? Commented Jul 7, 2020 at 18:11

1 Answer 1

1

The issue is Jenkins was expecting full paths to be given for all the files. After giving paths it started working fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.