tutorial plugin hub from compose docker jenkins jenkins-pipeline

plugin - Jenkins Docker Pipeline Exit Code-1



jenkins docker plugin (1)

Tenemos un archivo Jenkins que usa el complemento docker para ejecutar un script dentro de un contenedor determinado. Esto funciona bien para algunas imágenes, pero falla inmediatamente con un código de salida -1 en otras. Hemos reducido el error a un simple sleep . Este es el archivo Jenkins:

node("docker") { def wheezy_image = docker.image("pyca/cryptography-runner-wheezy") wheezy_image.pull() wheezy_image.inside { sh """sleep 120""" } }

Y aquí está la salida de Jenkins.

+ docker pull pyca/cryptography-runner-wheezy Using default tag: latest latest: Pulling from pyca/cryptography-runner-wheezy Digest: sha256:ff5d9f661b05d831ace3811eec9f034fed7994279ff2307695a2cb7c32d6fa11 Status: Image is up to date for pyca/cryptography-runner-wheezy:latest [Pipeline] sh [3525-VE2ETALXLYB7VN3] Running shell script + docker inspect -f . pyca/cryptography-runner-wheezy . [Pipeline] withDockerContainer $ docker run -t -d -u 1000:1000 -w /var/jenkins_home/workspace/3525-VE2ETALXLYB7VN3 --volumes-from 1382a2e208dd5575acd26f11678855282fc854319096de60cef6818ea279f25f -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat pyca/cryptography-runner-wheezy [Pipeline] { [Pipeline] sh [3525-VE2ETALXLYB7VN3] Running shell script + sleep 120 [Pipeline] } $ docker stop --time=1 887db8989e03a10dd89132b1ac6e18261ee4a49e6afe8b0c5568326b6c023654 $ docker rm -f 887db8989e03a10dd89132b1ac6e18261ee4a49e6afe8b0c5568326b6c023654 [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline GitHub has been notified of this commit’s build result ERROR: script returned exit code -1 Finished: FAILURE

Curiosamente, si el sueño es inferior a 1 segundo, esto pasa (pero el sueño de 120 segundos funciona bien en muchas de las otras imágenes).

Para referencia, aquí hay una imagen jessie que funciona, y una imagen sibilante que no funciona.

¿Alguien sabe lo que podría estar pasando aquí?


Parece estar relacionado con su imagen que no tiene ps instalado. Simplemente tomé la base debian y pude replicar que no funcionaría. PS instalado, y funcionó. También puede utilizar la función withRun y ​​funciona. Aquí está mi archivo Jenkins:

node("docker") { // Weezy that also ran... apt-get update && apt-get install -y procps def wheezy_image = docker.image("smalone/weezy-ps-test") wheezy_image.pull() wheezy_image.inside { sh ''sleep 2'' } // Base image for weezy-ps-test that has no ps installed using withRun() instead of inside() wheezy_image = docker.image("debian:wheezy") wheezy_image.pull() wheezy_image.withRun { c -> sh ''sleep 2'' } // Base image for weezy-ps-test that has no ps installed wheezy_image = docker.image("debian:wheezy") wheezy_image.pull() wheezy_image.inside { sh ''sleep 2'' } }

Abriré un ticket en el complemento de canalización de la ventana acoplable, si no existe uno.

EDITAR: Había un boleto abierto, pero aún no habían encontrado la causa raíz. Consulte: https://issues.jenkins-ci.org/browse/JENKINS-40101 para hacer un seguimiento del estado de este problema.