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
As you can see, Jenkins finds it without any issues:
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
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:
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:
Unfortunately, that didn't work either -- also, Jenkins didn't expand its WORKSPACE
environment variable:
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!
jenkins/ci-pipeline/Jenkinsfile
, on which branch did you moved it? F.e. if your multibranch is now building 50+ jobs and you moved that file on 1 branch (development) and reconfigured Jenkins to check the new path, the other 49 branches will not find that Jenkinsfile unless you merge your changes. It can be tricky to see this when you already have multiple jobs running.jenkins/ci-pipeline/Jenkinsfile
should work, it's case sensitive if I'm right..jenkins/ci-pipeline/Jenkinsfile
) and configured the script path to the new location and scan again, it runs fine. Same settings as you shared (without ${WORKSPACE}). So there's nothing wrong with your syntax. Are you running the latest Jenkins version + plugins (Bitbucket Branch Source Plugin)? issues.jenkins-ci.org/browse/JENKINS-49261