3
votes

I am creating jobs using Jenkins Organization Folders. I want to continuously build against pull request. However, when I create a pull request, it will be built automatically only the first time. Even if I add commit to pull request, Jenkins does not build automatically. I expect that build will work again when the commit is added to the branch that created the pull request.

I am using the following version of Jenkins / plugin.

  • Jenkins: 2.89.1
  • GitHub Branch Source Plugin: 2.3.1

GitHub Branch Source Plugin has the following settings.

  • Discover branches: Exclude branches that are also filed as PRs
  • Discover pull requests from origin: Merging the pull request with the current target branch revision
  • Discover pull requests from forks: Merging the pull request with the current target branch revision

Also, although I am using Github Enterprise, I think that the configuration of webhook is okay as the build runs instantly when creating the pull request for the first time.

2
Have you had a look in "Manage Jenkins" > "System Log" > "All Jenkins Logs"? I have a webhook setup on my repo, so when a push notification is received from GitHub, I see a log line like so: Received PushEvent for https://github.com/<organization>/<repo> from 192.30.252.45 ⇒ https://<your-jenkins-url>/github-webhook/. If you do see it, you can rule out the possibility of an incorrect webhook setup. Otherwise, it would become my prime suspect.Jonathan

2 Answers

0
votes

There is two way to resolve this issue

1) You have to configure your github repository so it inform jenkins of a new version: yourRepo/settings/hook&service/service ( the best practice)

or 2) you can configure your jenkins jobs so it check for diff time-to-time if the repo have been update : yourJob/configure/Scan Repository Triggers/Periodically -> 10 min

In my project, we configure both, with a Periodically check of once a day

0
votes

If you were talking about GitHub Organization folder, then there is a section where you can configure automatic branch triggering.

Automatic branch project triggering