GitHub Webhook: Organization Folder

Article ID:115003015711
2 minute readKnowledge base

Issue

  • How to make GitHub (and/or GitHub Enterprise) trigger jobs from GitHub Organization Folders in Jenkins.

Resolution

On Jenkins

A. Plugin Configuration

For GitHub Branch Source in case you wish to integrate with a GitHub Enterprise, it needs to be added in Manage Jenkins > Configure System > GitHub Enterprise Servers in order to fetch organizations from that endpoint.

GHE-apiEndpoints.png

B. Job Configuration

Steps:

  1. Create a new item of type Organization Folder

  2. In Repository Sources Add a source of type GitHub Organization

  3. If presented with API endpoint selection, choose between GitHub.com or your preconfigured GitHub Enterprise Servers

  4. For Credential use Username and Password, typing as password the personal API Token.

  5. For Owner specify the name of the GitHub Organization or GitHub User Account

  6. Since SCM API 2.2.4, Behaviors section > Make sure Filter by name is removed unless you only want to discover a subset of branches. If it is configured make sure to include PR-* to Discover Pull Requests.

Automatic branch project triggering > Branch names to build automatically Allows you to control the SCM commit trigger coming from branch indexing.

After saving the job, there is a view with contains all Repositories.

org_views.png

Each of the repositories contains Branches and Pull Request views as explained in [GitHub Webhook Pipeline Multibranch]

On GitHub

C. Validate GitHub WebHook

Make sure post-receive hooks has been created on GitHub at the Organization as follows:

  • <JENKINS_URL>/github-webhook/ for Pull request, Push and Repository events.

GH_webhook_Organzation.png

Troubleshooting

If the post-receive hooks are not there, please review Troubleshooting

Tested products/plugins version

The latest update of this article has been tested with: