Pau*_*rer 18 jenkins docker jenkins-pipeline
我们有一个Jenkinsfile,它使用docker插件在给定容器中运行脚本.这适用于某些图像,但在其他图像上立即失败,退出代码为-1.我们已将错误减少到简单sleep
.这是Jenkinsfile:
node("docker") {
def wheezy_image = docker.image("pyca/cryptography-runner-wheezy")
wheezy_image.pull()
wheezy_image.inside {
sh """sleep 120"""
}
}
Run Code Online (Sandbox Code Playgroud)
这是詹金斯的输出
+ 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
Run Code Online (Sandbox Code Playgroud)
有趣的是,如果睡眠时间不到1秒,那么这就会消失(但是120秒的睡眠在很多其他图像上都可以正常工作).
作为参考,这里有一个可行的jessie图像,以及没有的图像.
有谁知道这里会发生什么?
Spe*_*one 12
看起来与您没有ps
安装的图像有关.我刚刚接受了debian基础并且能够复制它不起作用.已安装ps,它确实有效.您也可以使用withRun功能,它可以工作.这是我的Jenkinsfile:
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'
}
}
Run Code Online (Sandbox Code Playgroud)
我将在docker管道插件上打开一张票,如果不存在的话.
编辑:打开了一张票,但他们还没有找到根本原因.请参阅:https://issues.jenkins-ci.org/browse/JENKINS-40101以跟踪此问题的状态!
归档时间: |
|
查看次数: |
6859 次 |
最近记录: |