0

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

Screenshot: Jenkins configured to look for Jenkinsfile in root folder

As you can see, Jenkins finds it without any issues:
Screenshot: Jenkins finds Jenkinsfile in root folder


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

Screenshot: Jenkins configured to look for Jenkinsfile in subfolder

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:
Screenshot: Jenkins cannot find Jenkinsfile in subfolder

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:
Screenshot: Jenkins configured with absolute path of subfolder

Unfortunately, that didn't work either -- also, Jenkins didn't expand its WORKSPACE environment variable:
Screenshot: Jenkins cannot find Jenkinsfile in subfolder, even with absolute path

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!

1
  • 1
    ${WORKSPACE} won't work because there isn't a workspace until a build is actually running. In other words, there is no workspace when just scanning for repos/branches in a Multibranch Pipeline folder.
    – jayhendren
    Commented Aug 8, 2019 at 18:19

1 Answer 1

0

This appears to be caused by the fact that I have an outdated version of the Bitbucket Branch Source Plugin (2.2.9).

For more details, see https://stackoverflow.com/a/57791004/5505583

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .