Jenkins 2 GitHub Organization: Automatic Rebuild for Pull Request

3.8k views Asked by At

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

There are 2 answers

0
sab On BEST ANSWER

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
sshepel On

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

Automatic branch project triggering