首页 文章

Jenkins很难从SCM找到JenkinsFile

提问于
浏览
0

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

enter image description here

这是我在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

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

谢谢!

1 回答

  • 2

    我认为由于你在问题中提到的文件名,你把它命名为错误 .

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

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

相关问题