Building PRs with github branch source

159 views
Skip to first unread message

Michael Neale

unread,
Jul 12, 2016, 5:45:03 AM7/12/16
to Jenkins Developers

Thanks to a recent update, github branch source can build origin PRs. 

However, I find the choice of checkboxes rather perplexing. 

The behavior I am seeing is that when there is an origin PR opened, it kicks off 2 builds, one for the PR and one for the branch, even if there is no merge needed with master (in the case of a merge commit validation). 

I can't quite fathom what the help text says, or what combinations to use. 

What I would like is for branch to be built, but only an additional build performed IF it actually isn't up to date with master. Is this possible at the moment or not? 

Perhaps another option is to not build branches, but only build PRs, then it would only show up once? (perhaps that is the expectation?)
Screen Shot 2016-07-12 at 7.29.15 PM.png

Jesse Glick

unread,
Jul 12, 2016, 11:44:21 PM7/12/16
to Jenkins Dev
On Tue, Jul 12, 2016 at 5:45 AM, Michael Neale <mne...@cloudbees.com> wrote:
> The behavior I am seeing is that when there is an origin PR opened, it kicks off 2 builds, one for the PR and one for the branch

Well that is what you requested—to build it both ways.

> even if there is no merge needed with master

Whether or not a merge is needed may change from build to build. Try
committing something to `master`. You should see a second build of the
PR job.

> I can't quite fathom what the help text says

PRs welcome.

BTW I did update the formal documentation to make mention of the new
options. But whoever is responsible for publishing these updates has
so far not done so. Perhaps you can help nudge them. When a
documentation person has the time, this documentation ought to get
moved to jenkins.io, or whatever the preferred home for plugin
documentation is these days (it seems to be in flux).

> What I would like is for branch to be built, but only an additional build performed IF it actually isn't up to date with master. Is this possible at the moment or not?

Not as such. Again, the checkboxes just control which *jobs* are
defined according to inherent aspects of the branches/PRs. The need
for, and validity of, a merge is liable to vary from one commit to the
next after the job has been created.

> Perhaps another option is to not build branches, but only build PRs, then it would only show up once?

Sure, just uncheck “Build origin branches also filed as PRs”.

Michael Neale

unread,
Jul 13, 2016, 12:07:11 AM7/13/16
to Jenkins Developers
Thanks, yes it makes sense now that I have seen it trigger PR rebuilds when master changes. This was surprising at first, but makes sense if you are to assume that validated against a merge with master means it is always safe to merge. 
Reply all
Reply to author
Forward
0 new messages