-
Bug
-
Resolution: Duplicate
-
Critical
-
None
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.
- blocks
-
JENKINS-49278 cat command in docker agents not detected correctly
-
- Reopened
-
- relates to
-
JENKINS-49278 cat command in docker agents not detected correctly
-
- Reopened
-
I suspect that the issue is with "cat" being added to the end. For example, if the entrypoint is something like:
ENTRYPOINT ["command", "--arg1", "--arg2"]
...then I suspect that the docker run would then be parsed as "command --arg1 --arg2 cat", based on https://docs.docker.com/engine/reference/builder/#entrypoint .
The workaround would probably be overriding the --entrypoint for the "cat" check.