【发布时间】:2020-02-21 02:34:36
【问题描述】:
我在虚拟机中安装了 Jenkins 和 Docker。我正在使用 Jenkins 管道项目,我的 jenkins 声明式管道看起来像这样。
pipeline {
agent {
docker { image 'node:7-alpine' }
}
stages {
stage('Test') {
steps {
echo 'Hello Nodejs'
sh 'node --version'
}
}
}
}
这个链接https://jenkins.io/doc/book/pipeline/docker/是一个非常基本的管道
当我尝试构建我的 jenkins 作业时,它会打印 Hello Nodejs,但会卡在下一条指令,即执行 shell 命令。 5 分钟后,作业失败并出现此错误
process apparently never started in /var/lib/jenkins/workspace/MyProject@tmp/durable-c118923c
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
ERROR: script returned exit code -2
我不明白为什么它不执行 sh 命令。
如果我将其设为agent any,它将执行sh 命令。
【问题讨论】:
-
请看我在这个帖子里的回复:stackoverflow.com/questions/58346984/…
-
我也有同样的问题。你解决了吗?
标签: docker jenkins jenkins-pipeline jenkins-plugins jenkins-declarative-pipeline