詹金斯无法从 SCM 中找到 JenkinsFile

use*_*642 4 git github jenkins jenkins-pipeline

我正在将旧的 Jenkins 构建迁移到新的声明性管道。现在我已经建立并运行了,我需要从 git 获取 JenkinsFile(而不是将它留在 Jenkins 窗口中)。问题是 Jenkins 从 Git 获取文件,但在拉出文件后在错误的位置查找它。这是配置:

在此处输入图片说明

这是我在 Jenkins 日志中收到的消息:

Checking out git https://github.com/xxx/xxx_dev.git to read Jenkinsfile
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/xxx/xxx_dev.git # timeout=10
Fetching upstream changes from https://github.com/xxx/xxx_dev.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials xxx Build
 > git fetch --tags --progress https://github.com/xxx/xxx_dev.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 43bd167e0e222fb517a8deb5ce6c6c6ba3619153 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 43bd167e0e222fb517a8deb5ce6c6c6ba3619153
 > git rev-list 82e6fdcce2587aa6368d63449ac57c9f02a1f835 # timeout=10
ERROR: /u03/jenkins/jobs/xxx/jobs/Build_Main/jobs/vs2015/workspace@script/Jenkinsfile not found
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)

似乎构建代理正在主 Jenkins 服务器机器上的某个位置寻找 Jenkins 文件。构建机器是windows机器,所以 /u03/jenkins/jobs/xxx/jobs/Build_Main/jobs/vs2015/workspace@script/Jenkinsfile 没有意义。有谁知道这里发生了什么?

谢谢!

nem*_*nho 5

由于您在问题中提到的文件名,我认为您将其命名为错误。

在您的项目的根目录中搜索了该脚本,应调用该脚本Jenkinsfile而不是JenkinsFile.

因此,正确命名文件并将其移动到存储库的根目录中。