具有并行阶段的詹金斯管道会导致“进程显然从未启动”错误

时间:2019-11-19 19:03:52

标签: jenkins jenkins-pipeline jenkins-plugins

我正在尝试建立Jenkins管道(使用声明性语法),该管道在两个单独的按需AWS EC2实例上运行单元和功能测试。当在单个实例上运行且没有并行阶段时,管道可以完美地工作。切换到并行阶段后,任何shell脚本都会失败,并显示以下神秘消息:

  

进程显然从未开始过   / home / admin / workspace / GSWebRuby_Test @ tmp / durable-b0d8c4b4(正在运行   詹金斯暂时与   -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS = true   可能会使问题更清楚)

我已经在Google上进行了广泛的搜索,并发现了Durable Task plugin的一些错误报告,这些错误报告似乎是造成此消息的原因。我正在使用最新版本的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

0 个答案:

没有答案