Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63691

Not able to execute shell scripts / ant process located in workspace

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • durable-task-plugin
    • None
    • Jenkins V2.235.2
      Jenkins Java v1.8
      Durable Task 1.33

      Attempting to build a packaged software, SAP Commerce which has an internal ant process. 

      ant tool configuration = $WORKSPACE/path/to/ant_home

      build jdk version is Java 11 SAP v .08

      Triage Notes

      • Ensured that jenkins user is building the code and that the jenkins user has access to those files via chmod 775
      • Ensured that the file paths were correct
      • Ensured that the script files were / are executable
      • Ensured that the script config for our Jenkins is set to bash
      • Tested using an ant process which is installed as a "tool" and found the process gets unblocked, therefore the problem,  I am assuming, is related to the workspace permissions / setup...as this does NOT happen when operating outside of a workspace.

      Additional Info

      Assumption is that the process may be negatively responding to the fact that the ant implementation is in the workspace vs installed as a tool...therefore there could be an issue reading the files from the workspace

      Steps in Pipeline

      steps {
          sh "export JAVA_HOME=/usr/lib/jvm/sapmachine-jdk-11.0.8"
      
         echo "run setantenv.sh"
         sh "cd $WORKSPACE/hybris/bin/platform &&. ./setantenv.sh"
      

      Console Output

      + cd /var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop/hybris/bin/platform
      + . ./setantenv.sh
      + OWN_NAME=setantenv.sh
      + basename -- /var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop@tmp/durable-2e9ca5a1/script.sh
      + BASENAME=script.sh
      + SOURCED=0
      + [ -n  ]
      + [ -n  ]
      + [ setantenv.sh != script.sh ]
      + SOURCED=1
      + [ 1 -ne 1 ]
      + export PLATFORM_HOME
      + pwd
      + PLATFORM_HOME=/var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop/hybris/bin/platform
      + export ANT_OPTS=-Xmx2g -Dfile.encoding=UTF-8 -Djdk.util.jar.enableMultiRelease=force
      + export ANT_HOME=/var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop/hybris/bin/platform/apache-ant
      + chmod +x /var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop/hybris/bin/platform/apache-ant/bin/ant
      + chmod +x /var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop/hybris/bin/platform/license.sh
      + ant -version
      /var/lib/jenkins/workspace/Hybris-ccv2/b2c_ccv2%2Fdevelop@tmp/durable-2e9ca5a1/script.sh: 34: ./setantenv.sh: ant: not found
      

      Error

      Errorhudson.AbortException: script returned exit code 127 at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.handleExit(DurableTaskStep.java:658) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.check(DurableTaskStep.java:604) at org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.run(DurableTaskStep.java:548) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
      

            jaydubb12 Jason Wolf
            jaydubb12 Jason Wolf
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: