简体   繁体   中英

Jenkins Multibranch pipeline cannot find Jenkinsfile in subfolder

I am using a Jenkins Multibranch pipeline -- specifically, an Organization folder, which monitors all my Bitbucket repos and builds a pipeline for any repo containing a Jenkinsfile. For simplicity, I have configured it to look at only 1 of my repos for now.

Here's my problem:

When the Jenkinsfile is located in the root folder of my repo, everything works fine -- Jenkins sees the Jenkinsfile, and creates the pipeline as defined in that Jenkinsfile.

repo
|
|___> Jenkinsfile

屏幕截图:Jenkins配置为在根文件夹中查找Jenkinsfile

As you can see, Jenkins finds it without any issues: 屏幕截图:Jenkins在根文件夹中找到Jenkinsfile


However, I want to move the Jenkinsfile to a subfolder in my repo (giving me the flexibility to have multiple pipelines defined for 1 repo). When I move it to a subfolder ( jenkins/ci-pipeline/Jenkinsfile ), even though I explicitly give that relative file path to Jenkins, it can no longer find the Jenkinsfile!!

repo
|
|___> jenkins
       |
       |___> ci-pipeline
              |
              |___> Jenkinsfile

屏幕截图:Jenkins配置为在子文件夹中查找Jenkinsfile

As you can see, despite giving the relative file path ( jenkins/ci-pipeline/Jenkinsfile ) to Jenkins, it claims it can no longer find the Jenkinsfile:
屏幕截图:Jenkins在子文件夹中找不到Jenkinsfile

Incidentally, even though the description of that Jenkins field says it is the "relative location", I tried to give it an absolute file path ( ${WORKSPACE}/jenkins/ci-pipeline/Jenkinsfile ) instead to see if that would work:
屏幕截图:Jenkins配置了子文件夹的绝对路径

Unfortunately, that didn't work either -- also, Jenkins didn't expand its WORKSPACE environment variable:
屏幕截图:即使具有绝对路径,Jenkins也无法在子文件夹中找到Jenkinsfile

I have also logged into my Jenkins worker node and confirmed that the Jenkinsfile is present in that subfolder, within the Jenkins workspace for my repo.


Can someone please tell me what I'm doing wrong?? This seems very simple, but it just refuses to work and it's driving me nuts!

As suggested by @Unforgettable631, this appears to be caused by the fact that I have an outdated version of the Bitbucket Branch Source Plugin (2.2.9). As mentioned in https://issues.jenkins-ci.org/browse/JENKINS-49261 , that version of the plugin has a bug where it cannot find the Jenkinsfile if it is in a subfolder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM