Can multibranch pipeline support user-selected branch?

16 views
Skip to first unread message

Guy Knights

unread,
Jun 11, 2019, 4:47:37 PM6/11/19
to jenkins...@googlegroups.com
I've been looking into multibranch pipeline and I'm wondering, can it be configured to support build parameters to specify which branches will be built?

I know the branch config can be setup with a regex to specify that certain branches will be built, but it means that the same branches will be built every time. I want whoever kicks off the job to be able to specify that only particular branches will build at different times.

Thanks,
Guy

David Karr

unread,
Jun 11, 2019, 6:41:37 PM6/11/19
to jenkins...@googlegroups.com
On Tue, Jun 11, 2019 at 1:47 PM Guy Knights <guy.k...@gmail.com> wrote:
I've been looking into multibranch pipeline and I'm wondering, can it be configured to support build parameters to specify which branches will be built?

I know the branch config can be setup with a regex to specify that certain branches will be built, but it means that the same branches will be built every time. I want whoever kicks off the job to be able to specify that only particular branches will build at different times.

I'm not sure if this is what you're looking for, but a multibranch pipeline can be specifically fired for a particular branch, with a url like this:

    http://host:port/jenkins/job/<folder>/job/<folder>/job/${PULL_REQUEST_TO_BRANCH}/buildWithParameters?...


Thanks,
Guy

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CANNH9msUkO1_Z3dF22%3D28qwToq%2BzfiNqcoe5ShHHfbVzN38G1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ivan Fernandez Calvo

unread,
Jun 12, 2019, 3:15:45 PM6/12/19
to Jenkins Users
I do not get your point, Multibranch pipeline creates a new job for each branch that match with the criteria you specify, so you have a job for every branch, I do not understand what do you mean with ’ I want whoever kicks off the job to be able to specify that only particular branches will build at different time’ maybe you can do do it with the ’when’ directive https://jenkins.io/doc/book/pipeline/syntax/#when

David Karr

unread,
Jun 12, 2019, 3:19:45 PM6/12/19
to jenkins...@googlegroups.com
On Wed, Jun 12, 2019 at 12:15 PM Ivan Fernandez Calvo <kuisat...@gmail.com> wrote:
I do not get your point, Multibranch pipeline creates a new job for each branch that match with the criteria you specify, so you have a job for every branch, I do not understand what do you mean with ’ I want whoever kicks off the job to be able to specify that only particular branches will build at different time’ maybe you can do do it with the ’when’ directive https://jenkins.io/doc/book/pipeline/syntax/#when

In the situation where we use this syntax, the job is not spawned from within a pipeline job, it's spawned from an external trigger in BitBucket.


--
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-use...@googlegroups.com.

Ivan Fernandez Calvo

unread,
Jun 12, 2019, 3:22:32 PM6/12/19
to Jenkins Users
Also, remember that every branch has his own Jenkins file so you can do what ever you want on every branch in that file it would effect only that branch.

Finally, if your problem is the logic that you use to trigger scheduled build I would suggest to use a regular pipeline job to make the logic and the build step to trigger the job that you want

Reply all
Reply to author
Forward
0 new messages