One CI job for 4 branches

54 views
Skip to first unread message

builderj

unread,
Mar 24, 2016, 11:58:52 AM3/24/16
to Jenkins Users
Hello experts

I'm just wondering if there is a way to set up ONE CI build job in Jenkins for 4 different branches. 

Here is the scenario. Dev team will be working on 4 different feature branches and check in changes regularly. So the parent CI job should looks for changes in all the 4 branches and trigger the build for the branches where changes were checked in.

Appreciate any help.

Thanks in advance.

Victor Martinez

unread,
Mar 25, 2016, 12:52:27 PM3/25/16
to Jenkins Users
you can use some regex in the branch name or use the below plugin https://wiki.jenkins-ci.org/display/JENKINS/Multi-Branch+Project+Plugin

first approach might help to use pushing rather than polling, second approach, as far as I know, it's polling based.

It does also depend on whether you would like to keep the history (unit test output, trend, .... ) independently, if so, first approach might not be the best one...

Cheers

Mark Waite

unread,
Mar 25, 2016, 3:30:01 PM3/25/16
to Jenkins Users
I think you'll like the results better if you have a job dedicated to each branch.  There are plugins that will allow you to automatically create a separate job for each branch that matches a pattern (multi-branch plugin, I think), or that will allow you to create a separate job for each branch that contains a workflow definition file ("Jenkinsfile").

With a job per branch, the history of the job is easy to read, including increases and decreases in coverage reports, test failures and successes, change log history, and more.

With one job that builds from multiple branches, your users spend time deciding which branch provided the changes on each build.  That's complicated and it is easy to be mislead by  changes from one build to the next when the changes also include a switch from one branch to another.

Mark Waite

--
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/b706f545-062e-48fd-bef3-c64b72a1a77e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Giroux

unread,
Mar 25, 2016, 4:46:05 PM3/25/16
to Jenkins Users
If you have created a post-update hook on the remote repository to notify Jenkins when a push occurs, you might consider configuration as:
Branch to build: **

Checkout to specific local branch: **  (requires Git plugin 2.4.4)

Build Triggers: Poll SCM but leave the schedule blank.  The job will only be scheduled if the post-update hook sends a push notification as described here: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-Pushnotificationfromrepository

This configuration will schedule a build whenever a push to the remote takes place.

Pro:  single jenkins job builds any branch when it is pushed to the remote

Con: build history has mixed branches.  See earlier comment from Mark Waite.  
Reply all
Reply to author
Forward
0 new messages