Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins Multibranch pipeline not triggering PR builds from Github

I'm using Jenkins 2.60.2. I've set up a Multibranch pipeline build. I also set up the Github side by configuring the Jenkins service via Integrations & services via the Github plugin (not the webhook option in Github).

I'm able to see the branches I want and some PRs that are sitting out there. So things seem to be working.

My issue is that when I add a commit to one of the pull requests, I see the event come through in the Repository Events, but the pull request never rebuilds in Jenkins. If I click Scan Repository Now, it detects the change and starts a new build of the PR. I would expect it to detect the change on the commit and rebuild the PR.

The other odd thing is that I have it set up to not build branches with PRs, but when I make a new PR from a new branch, it builds it as a branch (on the branches tab) but not on the PR tab. Again, running a repository scan, removes the build from the branches tab, and adds it to the PR tab. I would expect that a PR from a new branch would just create a build on the PR tab, not the branches.

I'm at a bit of a loss here. I can see when I push a change to Github, an event is getting sent to Jenkins, it just isn't behaving in the way I would expect.I'm using a Jenkinsfile in the repository if that makes any difference.

like image 259
rschlachter Avatar asked Aug 14 '17 22:08

rschlachter


People also ask

How do I trigger a build automatically in Jenkins?

Follow the steps as mentioned below to trigger a Jenkins job automatically based on GitHub's webhook configurations: Step 1: Go to the Configuration page of the respective job and under the build trigger section, check the "GitHub hook trigger for GITScm polling" checkbox and click on the Save button.

How do you trigger a Jenkins pipeline on a pull request?

For Jenkins to receive PR events through the pull request plugin, you need to add the Jenkins pull request builder payload URL in the Github repository settings. If you need just the PR triggers, you can select the “Let me select individual events” option and select just the “Pull requests” option.


1 Answers

So for now, I was able to carry on.

On Github, in Settings -> Integrations & services, I removed the Jenkins service. I went into Settings -> Webhooks, and I created a new Webhook with the same URL I used in the service and I picked the events to send. I am sending push events and pull request events and now things are working as I expected.

After looking at the repository events, it looks like using the Jenkins Service (Github plugin) on the Github side is not sending over pull request events. I'm trying to track down where to post that issue, but I'm unsure.

Hopefully this helps someone else out.

like image 85
rschlachter Avatar answered Oct 14 '22 04:10

rschlachter