After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:

      stage ('Unit Tests') {
      try {
         dir ("./somewhere/somepath") {
            sh "./somewhere/some.sh"
         }
         def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
         image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
            sh "./somewhere/someother.sh"
            junit 'nosetests.xml'
            step([$class: 'CoberturaPublisher',
              /* ... */ ])
            sh "git clean -fdx"
          }
        } finally {
          sh "./somewhere/somefinal.sh || true"
        }
      }

       

      All of the scripts here would run, but somewhere/someother.sh on some jobs would exit early and other jobs (different projects, same format) would complete successfully but still return a -1, such as:

      ERROR: script returned exit code -2

       

      Reverting to docker-workflow 1.14 alleviated the problems.

       

      I started with docker-engine 17.06 running on Debian Stretch and while diagnosing these problems upgraded to docker-ce (17.12.0-ce, build c97c6d6).  Upgrading docker made no difference.

       

          [JENKINS-49385] containers exit early in docker-workflow 1.15

          Marques Johansson created issue -
          Marques Johansson made changes -
          Description Original: After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:
          ERROR: script returned exit code -2
          in the middle of performing blocks like this:
          {code:java}
          sh "something.sh"{code}
          Reverting to docker-workflow 1.14 alleviated the problems.

           

          All of the scripts here would run, but somewhere/someother.sh would exit (as about with a -2) or all of the scripts would complete successfully but still return a -1.

           
          {code:java}
          stage ('Unit Tests') {
          try {
             dir ("./somewhere/somepath") {
                sh "./somewhere/some.sh"
             }
             def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
             image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
                sh "./somewhere/someother.sh"
                junit 'nosetests.xml'
                step([$class: 'CoberturaPublisher',
                  /* ... */ ])
                sh "git clean -fdx"
              }
            } finally {
              sh "./somewhere/somefinal.sh || true"
            }
          }{code}
          New: After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:
          {code:java}
          stage ('Unit Tests') {
          try {
             dir ("./somewhere/somepath") {
                sh "./somewhere/some.sh"
             }
             def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
             image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
                sh "./somewhere/someother.sh"
                junit 'nosetests.xml'
                step([$class: 'CoberturaPublisher',
                  /* ... */ ])
                sh "git clean -fdx"
              }
            } finally {
              sh "./somewhere/somefinal.sh || true"
            }
          }{code}
           

          All of the scripts here would run, but somewhere/someother.sh would exit (as about with a -2) or all of the scripts would complete successfully but still return a -1, such as:
          {code:java}
          ERROR: script returned exit code -2{code}
           

          Reverting to docker-workflow 1.14 alleviated the problems.

           

           
          Marques Johansson made changes -
          Description Original: After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:
          {code:java}
          stage ('Unit Tests') {
          try {
             dir ("./somewhere/somepath") {
                sh "./somewhere/some.sh"
             }
             def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
             image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
                sh "./somewhere/someother.sh"
                junit 'nosetests.xml'
                step([$class: 'CoberturaPublisher',
                  /* ... */ ])
                sh "git clean -fdx"
              }
            } finally {
              sh "./somewhere/somefinal.sh || true"
            }
          }{code}
           

          All of the scripts here would run, but somewhere/someother.sh would exit (as about with a -2) or all of the scripts would complete successfully but still return a -1, such as:
          {code:java}
          ERROR: script returned exit code -2{code}
           

          Reverting to docker-workflow 1.14 alleviated the problems.

           

           
          New: After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:
          {code:java}
          stage ('Unit Tests') {
          try {
             dir ("./somewhere/somepath") {
                sh "./somewhere/some.sh"
             }
             def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
             image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
                sh "./somewhere/someother.sh"
                junit 'nosetests.xml'
                step([$class: 'CoberturaPublisher',
                  /* ... */ ])
                sh "git clean -fdx"
              }
            } finally {
              sh "./somewhere/somefinal.sh || true"
            }
          }{code}
           

          All of the scripts here would run, but somewhere/someother.sh on some jobs would exit early and other jobs (different projects, same format) would complete successfully but still return a -1, such as:
          {code:java}
          ERROR: script returned exit code -2{code}
           

          Reverting to docker-workflow 1.14 alleviated the problems.

           

           
          Marques Johansson made changes -
          Description Original: After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:
          {code:java}
          stage ('Unit Tests') {
          try {
             dir ("./somewhere/somepath") {
                sh "./somewhere/some.sh"
             }
             def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
             image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
                sh "./somewhere/someother.sh"
                junit 'nosetests.xml'
                step([$class: 'CoberturaPublisher',
                  /* ... */ ])
                sh "git clean -fdx"
              }
            } finally {
              sh "./somewhere/somefinal.sh || true"
            }
          }{code}
           

          All of the scripts here would run, but somewhere/someother.sh on some jobs would exit early and other jobs (different projects, same format) would complete successfully but still return a -1, such as:
          {code:java}
          ERROR: script returned exit code -2{code}
           

          Reverting to docker-workflow 1.14 alleviated the problems.

           

           
          New: After updating to docker-workflow 1.15 all of my builds that folllow this pattern started exiting with status -1 or -2:
          {code:java}
          stage ('Unit Tests') {
          try {
             dir ("./somewhere/somepath") {
                sh "./somewhere/some.sh"
             }
             def userid = sh(script: 'grep Uid /proc/self/status | cut -f2', returnStdout: true).trim()
             image.inside("-v ${env.WORKSPACE}:/target -e USER=${env.USER} -e USERID=${userid} -e BRANCH_NAME=${BRANCH_NAME} -u ${userid} --link ...") { c ->
                sh "./somewhere/someother.sh"
                junit 'nosetests.xml'
                step([$class: 'CoberturaPublisher',
                  /* ... */ ])
                sh "git clean -fdx"
              }
            } finally {
              sh "./somewhere/somefinal.sh || true"
            }
          }{code}
           

          All of the scripts here would run, but somewhere/someother.sh on some jobs would exit early and other jobs (different projects, same format) would complete successfully but still return a -1, such as:
          {code:java}
          ERROR: script returned exit code -2{code}
           

          Reverting to docker-workflow 1.14 alleviated the problems.

           

          I started with docker-engine 17.06 running on Debian Stretch and while diagnosing these problems upgraded to docker-ce (17.12.0-ce, build c97c6d6).  Upgrading docker made no difference.

           
          Christoph Forster made changes -
          Link New: This issue relates to JENKINS-49278 [ JENKINS-49278 ]
          jamie norman made changes -
          Priority Original: Minor [ 4 ] New: Critical [ 2 ]
          Nicolas De Loof made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Scott Williams made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Nicolas De Loof made changes -
          Assignee New: Nicolas De Loof [ ndeloof ]
          Nicolas De Loof made changes -
          Link New: This issue blocks JENKINS-49278 [ JENKINS-49278 ]
          Nicolas De Loof made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Reopened [ 4 ] New: Resolved [ 5 ]

            ndeloof Nicolas De Loof
            displague Marques Johansson
            Votes:
            6 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved: