jenkins - 具有并行阶段的 Jenkins 管道导致“进程显然从未启动”错误
问题描述
我正在尝试设置一个 Jenkins 管道(使用声明性语法),该管道在两个单独的按需 AWS EC2 实例上运行单元和功能测试。当在单个实例上运行且没有并行阶段时,管道可以完美运行。一旦我切换到并行阶段,任何 shell 脚本都会失败并显示以下神秘消息:
进程显然从未在 /home/admin/workspace/GSWebRuby_Test@tmp/durable-b0d8c4b4 开始(使用 -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true 临时运行 Jenkins 可能会使问题更清楚)
我在 Google 上进行了广泛搜索,发现了几个似乎是造成此消息的Durable Task 插件的错误报告。我正在使用最新版本的插件 v. 1.33 并且似乎没有任何问题适用于我的案例,例如异常架构或运行 Docker 容器时的故障。我还对插件进行了降级和重新升级(在 1.30 和 1.33 版本之间切换)。此外,要重新迭代,sh
当我不使用parallel
阶段时,命令可以正常工作。
我创建了一个简化的管道来调试问题。请注意,shell 命令也很简单,例如“env | sort”或“pwd”。
pipeline {
agent none
environment {
DB_USER = credentials('db-user')
DB_PASS = credentials('db-pass')
}
stages {
stage('Setup'){
failFast false
parallel {
stage('foo') {
agent {
label 'jenkins-slave-ondemand'
}
steps {
echo 'In stage foo'
sh 'env|sort'
}
}
stage('bar') {
agent {
label 'jenkins-slave-ondemand'
}
steps {
echo 'In stage bar'
sh 'pwd'
}
}
}
}
}
}
这是控制台输出:
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] withCredentials
Masking supported pattern matches of $DB_PASS or $DB_USER
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Setup)
[Pipeline] parallel
[Pipeline] { (Branch: foo)
[Pipeline] { (Branch: bar)
[Pipeline] stage
[Pipeline] { (foo)
[Pipeline] stage
[Pipeline] { (bar)
[Pipeline] node
[Pipeline] node
Still waiting to schedule task
All nodes of label ‘jenkins-slave-ondemand’ are offline
Still waiting to schedule task
All nodes of label ‘jenkins-slave-ondemand’ are offline
Running on EC2 (Jenkins AWS EC2) - Jenkins slave (i-0982299c572100c71) in /home/admin/workspace/GSWebRuby_Test
[Pipeline] {
[Pipeline] echo
In stage foo
[Pipeline] sh
Running on EC2 (Jenkins AWS EC2) - Jenkins slave (i-092ecac8e6c257270) in /home/admin/workspace/GSWebRuby_Test
[Pipeline] {
[Pipeline] echo
In stage bar
[Pipeline] sh
process apparently never started in /home/admin/workspace/GSWebRuby_Test@tmp/durable-b0d8c4b4
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
Failed in branch foo
process apparently never started in /home/admin/workspace/GSWebRuby_Test@tmp/durable-b6cfcff9
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
Failed in branch bar
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE
我在设置管道的方式上做错了吗?任何指针将不胜感激。
编辑:
设置后JENKINS_JAVA_OPTIONS
org.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true
,我看到了这个额外的输出:
In stage bar
[Pipeline] sh
nohup: failed to run command 'sh': No such file or directory
process apparently never started in /home/admin/workspace/GSWebRuby_Test@tmp/durable-099a2e56
解决方案
推荐阅读
- python - 修改影响所有数据框,而不是选择的列
- c++ - switch 语句不会执行
- r - r 使用 NA 过滤日期
- sql - 在 SQL 中创建临时表时,如果一个相关记录为 TRUE 但其他记录为 FALSE,如何将所有布尔值设置为 TRUE
- vb.net - 如何在 Windows 窗体中搜索文本 (Visual Basic)
- html - (引导程序)如何将 h1 垂直对齐到中间
- django - 如何设置 Redis 在通道层中不起作用?
- python-3.x - 使用请求 Python 3 从查看源代码中抓取值
- sql - 为什么在 SQL 中将 NVL 放在 WHEN 周围?
- python - 如何从 iwidgets.interact 获取数字?