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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Component/s: durable-task-plugin
    • Labels:
      None
    • Environment:
      Jenkins V2.235.2
      Jenkins Java v1.8
      Durable Task 1.33
    • Similar Issues:

      Description

      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)
      

        Attachments

          Activity

          Hide
          jaydubb12 Jason Wolf added a comment -

          Closing defect. Found the issue to be with the workspace appending the unencoded character(s) within the URL...and actually had NOTHING to do with the durable task feature. I solved this by using the following script which was provided by this ticket - https://issues.jenkins-ci.org/browse/JENKINS-38706

           

          agent{
              node{
                  label 'master'
                  customWorkspace "${JENKINS_HOME}/Workspace/${URLDecoder.decode(JOB_NAME)}"
              }
          }
          
          Show
          jaydubb12 Jason Wolf added a comment - Closing defect. Found the issue to be with the workspace appending the unencoded character(s) within the URL...and actually had NOTHING to do with the durable task feature. I solved this by using the following script which was provided by this ticket -  https://issues.jenkins-ci.org/browse/JENKINS-38706   agent{ node{ label 'master' customWorkspace "${JENKINS_HOME}/Workspace/${URLDecoder.decode(JOB_NAME)}" } }

            People

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

              Dates

              Created:
              Updated:
              Resolved: