Multibranch pipeline script path doesn't work with anything other then Jenkinsfile

305 views
Skip to first unread message

Ian Smith

unread,
Aug 31, 2017, 11:40:00 AM8/31/17
to Jenkins Users
Hi,

I'm trying to run two distinct pipelines from one repo. So currently I have an existing multibranch pipeline that uses a Jenkinsfile at the top of the repo. This is triggered on both an update to a PR branch and when a merge to the HEAD happens on github.

I want a second pipeline to only trigger on PR update, so have created a second multibranch pipeline. I am using version 2.15 of the Pipeline: Multibranch plugin that has now added Script Path as per JENKINS-34561. So my understanding is that if I define that Script Path as something else then that pipeline file will be used.

However it appears that this will work if and only if Script Path is set to Jenkinsfile i.e. the file at the repo. Anything else it will claim not to find even though I can checkout out the PR and confirm the file is present.

So I have multiple versions of the file that I want to use called

  • CIPerformanceTest
  • subdir/CIPerformanceTest
  • subdirtest/Jenkinsfile

And I have changed the value of Script Path to

  • CIPerformanceTest
  • subdir
  • subdir/CIPerformanceTest
  • subdirtest
  • subdirtest/Jenkinsfile

In all cases I see an error in the scan repository log that the file cannot be found despite the fact that I can checkout the PR and confirm that all of the files mentioned are present.

In fact Script Path only works if and only if it contains Jenkinsfile.

What am I missing, or am I seeing a known bug?

Kind regards,
Ian

Ian Smith

unread,
Sep 1, 2017, 10:13:22 AM9/1/17
to Jenkins Users
Turns out that in the multibranch scan repository it only checks if the file in the Script Path exists on the HEAD. So if I want to check that a new script, that is currently being developed, works with Jenkins then I need to

  1. Create a PR that creates a dummy version of the file and then get that merged to master
  2. Then checkout the new master, create a new branch and change the dummy version of the file and then create the PR
  3. And then create the multibranch pipeline script
The side effect of this is that the scan repository checks out the current HEAD and then merges that change to all currently opened PRs. This means that the new script, that I only want to test on one PR branch, the dummy version on HEAD gets applied to all open PRs regardless of the file existing or not existing there. This seems wrong to me.

So the answer to the original question is "yes you can set Script Path to anything as long as it currently exists on the repo's master".

Kind regards, Ian

Stephen Connolly

unread,
Sep 1, 2017, 11:16:22 AM9/1/17
to jenkins...@googlegroups.com
Likely your PRs are not "trusted". If the PR is "trusted" then the PR's Jenkinsfile can be used. Check what trust strategy you configured when defining the source

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8f41a340-5f2e-4ec4-95a4-a564fbb7a803%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages