陷入“ sh”阶段,然后进程显然从未在/ home / jenkins / jenkins / workspace /中启动

时间:2019-11-14 03:09:38

标签: docker jenkins jenkins-pipeline

“ mvn clean”阶段卡住了一段时间,并导致以下错误:

[Pipeline] sh
process apparently never started in /home/jenkins/jenkins/workspace/<MyProject>@tmp/durable-8e4de4ec
(running Jenkins temporarily with -D 
org.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem 
clearer)
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE

这是我的jenkinsfile脚本:

pipeline{
agent{
    label 'DOCKER'
}
tools { 
    maven 'M3' 
    jdk 'JAVA_HOME' 
}
stages{
    stage('build'){
        steps{
            echo 'Running Build Phase'
            sh 'mvn clean'
        }
    }
}
}

不确定是否需要更新任何配置。我已经使用更新的open-jdk版本更新了/etc/init.d/jenkins。

enter image description here

2 个答案:

答案 0 :(得分:3)

我遇到了同样的问题,发现如果您转到Manage Jenkins-> Configure System,则“全局属性”部分将有一个空的环境变量。只需删除该变量即可解决问题。

答案 1 :(得分:0)

结合 jenkins kubernetes-plugin,它可能是 Pipeline sh step hangs when multiple containers are used 部分中描述的 here (Kubernetes plugin for Jenkins) 问题。