6

We are using Github for source control and Jenkins for our builds.

In Jenkins, we are using GitHub Organization Folder plugin along with Multibranch pipeline plugin. This causes the repository to show up in Jenkins, and each repository has a Jenkinsfile in it. And each PR(in github) has a status check, which checks if the build of the PR is good or not.

Everything works fine, except for the fact that once a PR is opened or updated, the PR is not built in Jenkins automatically. You have to manually go to Jenkins and trigger the PR build.

As far as master branch is concerned, it works like a charm. If the master branch is updated, Jenkins automatically triggers the build.

I have attached the screen shot of the branch configuration in Jenkins for the GitHub Organization. So my question is what should be done for PR opening or updating, that would cause Jenkins to start build automatically.

enter image description here

enter image description here

2 Answers 2

3

It sounds like maybe you need to configure a webhook for git if you are using the git plugin, but I think that may just build the master branch. I haven't used git much, so you might be able to use the web hook to have it build the pull request - I don't know.

Instead, you might want to check out the pull request builder plugin and see if that does what you are looking for.

1

According to the official documentation for the GitHub Branch Source plugin:

While the build triggers are often enough, you can set up webhooks to automatically trigger builds when changes are pushed to your GitHub repositories. To do this you must have a GitHub login with a token.

  1. Go to the main configuration settings page, Manage Jenkins > Configure System

  2. In the GitHub Plugin Configuration section, add a server with your credentials

  3. If you need a token, generate one with the Additional Actions > Convert login to password and token

You can also configure this manually through GitHub itself by registering the URL provided in the help section of the server config.

2
  • 1
    You can trigger on push but can you trigger on a pull request submission Nov 17, 2017 at 18:09
  • Not sure. I haven't used the GitHub Branch Source plugin myself. I have used its sister plugin, the Bitbucket Branch Source plugin, which requires a second plugin on the Bitbucket end to trigger builds from PRs.
    – jayhendren
    Nov 17, 2017 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.