How do I trigger jenkins job if a pull request is merged in github

23 views
Skip to first unread message

jsake...@gmail.com

unread,
Aug 3, 2018, 8:19:04 AM8/3/18
to Jenkins Users
Hi All,

We don't use multi branch pipeline. But , we use pipeline Jenkins job written in jenkisnfile.
I want to know the steps to do on github and jenkinsfile side to trigger the Jenkins job if a pull request is merged to a particular branch.





Ramanathan Muthaiah

unread,
Aug 3, 2018, 10:58:11 AM8/3/18
to Jenkins Users
We don't use multi branch pipeline. But , we use pipeline Jenkins job written in jenkisnfile.
I want to know the steps to do on github and jenkinsfile side to trigger the Jenkins job if a pull request is merged to a particular branch.

Multibranch (or GHE organization, if you prefer) is the way to go for this, saves you from setting up that many projects for each branch. In GH, select all the events to be sent to your Jenkins.

If you choose multibranch, there will be additional steps in the branch selection, what to do with origin and fork PRs.

/Ram 

jsake...@gmail.com

unread,
Aug 3, 2018, 4:06:39 PM8/3/18
to Jenkins Users
I want to use only pullrequestevent, so when a pull request is merged, it should run a script or hook, which would do all the checks like
if a pull request is merged or not / if teh branch is release or not etc.
if teh condition satisfies, it shoud run the jenkins job.

Ramanathan Muthaiah

unread,
Aug 5, 2018, 2:40:03 AM8/5/18
to Jenkins Users
On Saturday, August 4, 2018 at 1:36:39 AM UTC+5:30, jsake...@gmail.com wrote:
I want to use only pullrequestevent, so when a pull request is merged, it should run a script or hook, which would do all the checks like
if a pull request is merged or not / if teh branch is release or not etc.
if teh condition satisfies, it shoud run the jenkins job

Pick and choose the events to be sent over from GH to Jenkins. For the rest of the checks, you can write Groovy scripts.

If you need help, refer to doc on shared libraries -- with that, your Groovy code can scale and serve multiple projects, if they all follow the same workflow as you outlined.
Reply all
Reply to author
Forward
0 new messages