Resume my Multibranch Pipeline when a code review is submitted

19 views
Skip to first unread message

Sameera Priyatham Tadikonda

unread,
Feb 20, 2019, 1:56:14 PM2/20/19
to Jenkins Users
I integrated Jenkins with Github using web hooks and I created a multi-branch pipeline and I am using JenkinsFile.

Jobs are created automatically and I am able to run the tests when a PR is created.Once the tests are passed my pipeline waits for the code review to be completed before merging.

I would like to merge the PR when the code review is done. 

I am pushing all the Web hook events from Github to Jenkins.

How can I resume my pipeline when a code-review event is pushed to my Jenkins.

Please help me if anyone worked on this.

László Boros

unread,
Feb 26, 2019, 7:36:16 AM2/26/19
to prasad.pofali via Jenkins Users
Hi,

I'm not sure if you've received any response, but I see two possible solutions:

* create a separate job in Jenkins for these merges, subscribe to the "code review approved" events from Github and work from that
* in the pipeline, create an "infinite loop" with some sensible upper limit (like 3 days) to wait for the code review to happen, check the PR state in a loop and then sleep some minutes to save computational power and when the PR is approved, do the merge. Or if the time limit is up, exit the job with failure.

Both of them have advantages and disadvantages: the second one is more aligned with the "1 job for 1 PR" idea, but the waiting in loop wastes computational power and also keeps agents reserved. In this regard the first one is much better, but then the testing and merging actions are done by separate jobs.

I don't know technical details about how to implement these since I don't use the Github plugin, but I hope these ideas help.
BR,
Laszlo


--
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/e1f72226-99c6-4221-acfb-8047c76805c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages