java - 进程显然从未在 C :\Users\<user>\. jenkins\workspace\<jenkin_project>@tmp\durable-d3479d32 脚本返回退出代码 -2 中启动

标签 java maven jenkins jenkins-plugins jenkins-pipeline

我正在尝试构建一个管道来构建在 github 上提交的 java maven 项目管道。 我已经在我的 Windows 机器上安装了 Jenkins 。 我的管道在以下阶段受到打击

Started by user Akshay Katti
Obtained Jenkinsfile from git C:\Users\ak186148\git\Kylo-Accelerator
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] node
Running on Jenkins in C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
 > git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git.exe config remote.origin.url C:\Users\ak186148\git\Kylo-Accelerator # timeout=10
Fetching upstream changes from C:\Users\ak186148\git\Kylo-Accelerator
 > git.exe --version # timeout=10
 > git.exe fetch --tags --progress C:\Users\ak186148\git\Kylo-Accelerator +refs/heads/*:refs/remotes/origin/*
 > git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
 > git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision e8ad0282a7fbd877461b3866a15f0116b2848065 (refs/remotes/origin/master)
 > git.exe config core.sparsecheckout # timeout=10
 > git.exe checkout -f e8ad0282a7fbd877461b3866a15f0116b2848065
Commit message: "Add initial Jenkinsfile"
 > git.exe rev-list --no-walk e8ad0282a7fbd877461b3866a15f0116b2848065 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
[C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD] Running shell script
nohup: failed to run command 'sh': No such file or directory
process apparently never started in C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD@tmp\durable-b24ab647
[Pipeline] sh
[C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD] Running shell script
nohup: failed to run command 'sh': No such file or directory
process apparently never started in C:\Users\ak186148\.jenkins\workspace\Kylo-Promoter-CI-CD@tmp\durable-5e2947b3
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE

请查找附件中的我的 Jenkinsfile(我已从 sh 更改为 bat)

pipeline {
    agent {
        docker {
            image 'maven:3-alpine' 
            args '-v /root/.m2:/root/.m2' 
        }
    }
    stages {
        stage('Build') 
        { 
            steps {
                bat 'mvn -B -DskipTests clean package' 
            }
        }
    }
}

另外,请在蓝海页面上找到以下错误 blue_ocean_error

请帮忙。

最佳答案

这个“进程显然从未启动”是一个通用错误,可能有不同的原因,因此:

  1. 检查您的 Jenkins 服务器版本是否使用最新的 DurableTask 插件,因为该插件的 < 1.28 版本可能会导致此特定错误 ( more info ),所以让我们消除第一个嫌疑点。
  2. 如果 1. 不适用或不起作用,根据之前的答案,诀窍是获取有关实际导致错误的原因的更多信息,为此您可以:
    1. 执行 org.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true在 Jenkins 的脚本控制台中进行调试(需要成为 Jenkins 管理员),然后重新启 Action 业以查看作业控制台输出中是否有有用的新信息
    2. 激活上一个答案中提到的日志,但您不需要重新启动 Jenkins 或有权访问托管 Jenkins 的服务器,您只需成为 Jenkins 管理员并使用 'System Logs' administration pageorg.jenkinsci.plugins.durabletask 创建日志记录器并重新启动您的作业以查看您的自定义日志记录器中是否有有用的新信息。
<小时/>

就我而言,激活 LAUNCH_DIAGNOSTICS通过系统控制台给了我以下错误:

nohup: impossible d'exécuter la commande « sh »: Aucun fichier ou dossier de ce type

显然,路径有问题。 This answer在类似的问题上然后帮助我注意到这是由于系统配置页面中的 PATH 环境变量的修改引起的。

关于java - 进程显然从未在 C :\Users\<user>\. jenkins\workspace\<jenkin_project>@tmp\durable-d3479d32 脚本返回退出代码 -2 中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51249727/

相关文章:

javascript - 如何使用 Jenkins 在 CI 中的 Cypress 仪表板中填充作者、分支、提交、消息?

java - 扫描仪抛出 NoSuchElementException

java - 加到 n 的 1 + 2 的所有组合

java - Jenkins Git API

maven - Gradle 如何与共享 Ivy 或 Maven 存储库集成?

maven - 在 Maven 项目中分析 TypeScript SonarQube

jenkins - 运行 Jenkins 时的控制台输出

ruby - 无法运行 Jenkins Build - bundle : "command not found"

java - Java中如何调用另一个方法中的方法(同一个类)

maven - maven 会自动下载 Artifact 依赖项吗?