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

Pipeline plugin sh script returned exit code -2 from time to time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • kubernetes-plugin
    • None
    • kubernetes1.8.4 jenkins 2.32.3(fabric8/jenkins-docker) jenkins kubernetes plugin 1.3.1

      I am using kubernetes plugin to build my ci environment on a kubernetes cluster. There is a pipeline block like below:

      stage ('Compile client & go src') {
      dir('./src/main/docker/go/src/portal') {
      sh "pwd; \
      cd /home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal/; \
      export GOPATH=${env.WORKSPACE}/src/main/docker/go; \
      gvt restore || true"

      }

      }

      but the sh block fails from time to time. In the console output there are even incomplete log like this:
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Compile client & go src)
      [Pipeline] dir
      Running in /home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal
      [Pipeline] {
      [Pipeline] sh
      [portal] Running shell script
      Executing shell script inside container [maven] of pod [kubernetes-jcl72]
      Executing command: sh -c echo $$ > '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/pid'; jsc=durable-d2043139f4d662aef846252c818e1165; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/script.sh' > '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/jenkins-result.txt'
      cd "/home/jenkins/workspace/portal_v3.0"
      sh -c echo $$ > '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/pid'; jsc=durable-d2043139f4d662aef846252c818e1165; JENKINS_SERVER_COOKIE=$jsc '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/script.sh' > '/home/jenkins/workspace/portal_v3.0/src/main/docker/go/src/portal@tmp/durable-ed3533f2/jenkins-log.txt' 2>&1; echo $? > '/home/jenkins/wo[?1034hsh-4.2# [Pipeline] }

       

      It the last line, the word "workspace" was truncated to "wo".

      I tried 5 times. it fails 2 times and success 3 times.

      I do not think it is a dupe of JENKINS-46545 because I have many time success

       

            Unassigned Unassigned
            garyyang garyyang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: